[1.0.2] fix wrong condition
[platform/core/multimedia/libmm-player.git] / src / mm_player_gst.c
index 8747a9b..234170c 100644 (file)
@@ -300,17 +300,17 @@ __mmplayer_gst_handle_resource_error(mmplayer_t *player, int code, GstMessage *m
                break;
        case GST_RESOURCE_ERROR_NOT_FOUND:
        case GST_RESOURCE_ERROR_OPEN_READ:
-               if (MMPLAYER_IS_HTTP_STREAMING(player) || MMPLAYER_IS_HTTP_LIVE_STREAMING(player)
-                       || MMPLAYER_IS_RTSP_STREAMING(player)) {
+               if (MMPLAYER_IS_STREAMING(player)) {
                        trans_err = MM_ERROR_PLAYER_STREAMING_CONNECTION_FAIL;
                        break;
                }
        case GST_RESOURCE_ERROR_READ:
-               if (MMPLAYER_IS_HTTP_STREAMING(player) || MMPLAYER_IS_HTTP_LIVE_STREAMING(player)
-                       || MMPLAYER_IS_RTSP_STREAMING(player)) {
+               if (MMPLAYER_IS_STREAMING(player)) {
                        trans_err = MM_ERROR_PLAYER_STREAMING_FAIL;
                        break;
-               } else if (message != NULL && message->src != NULL) {
+               }
+
+               if (message != NULL && message->src != NULL) {
                        storage_state_e storage_state = STORAGE_STATE_UNMOUNTABLE;
                        mmplayer_path_type_e path_type = MMPLAYER_PATH_MAX;
 
@@ -785,6 +785,11 @@ __mmplayer_gst_extract_tag_from_msg(mmplayer_t *player, GstMessage *msg)
                if (gst_tag_list_get_date_time(tag_list, gsttag, &datetime)) {\
                        if (datetime != NULL) {\
                                string = g_strdup_printf("%d", gst_date_time_get_year(datetime));\
+                               if (string == NULL) {\
+                                       LOGD("failed to get year from tag");\
+                                       gst_date_time_unref(datetime);\
+                                       break;\
+                               } \
                                mm_player_set_attribute((MMHandleType)player, NULL,\
                                                playertag, string, strlen(string), NULL); \
                                SECURE_LOGD("metainfo year : %s", string);\
@@ -1931,30 +1936,6 @@ __mmplayer_dump_collection(GstStreamCollection * collection)
 }
 
 static void
-__mmplayer_stream_notify_cb(GstStreamCollection *collection,
-                       GstStream *stream, GParamSpec *pspec, gpointer data)
-{
-       LOGD ("Got stream-notify from stream %s for %s (collection %p)\n",
-                               gst_stream_get_stream_id(stream), pspec->name, collection);
-       if (g_str_equal(pspec->name, "caps")) {
-               GstCaps *caps = gst_stream_get_caps(stream);
-               MMPLAYER_LOG_GST_CAPS_TYPE(caps);
-               gst_caps_unref(caps);
-       }
-
-#ifdef __DEBUG__
-       if (g_str_equal (pspec->name, "tags")) {
-               GstTagList *tags = gst_stream_get_tags(stream);
-               if (tags) {
-                       LOGD ("  tags:\n");
-                       gst_tag_list_foreach(tags, __mmplayer_print_tag_foreach, GUINT_TO_POINTER(MMPLAYER_TAG_INDENT));
-                       gst_tag_list_unref(tags);
-               }
-       }
-#endif
-}
-
-static void
 __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
 {
        mmplayer_t *player = (mmplayer_t *)(data);
@@ -2066,15 +2047,6 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
                gst_message_parse_stream_collection(msg, &collection);
                if (collection) {
                        __mmplayer_dump_collection(collection);
-                       if (player->collection && player->stream_notify_id) {
-                               g_signal_handler_disconnect(player->collection, player->stream_notify_id);
-                               player->stream_notify_id = 0;
-                       }
-                       gst_object_replace((GstObject **)&player->collection, (GstObject *)collection);
-                       if (player->collection) {
-                               player->stream_notify_id = g_signal_connect(player->collection, "stream-notify",
-                                                       (GCallback)__mmplayer_stream_notify_cb, player);
-                       }
                        gst_object_unref(collection);
                }
        } break;
@@ -2095,7 +2067,7 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
                                        gst_object_unref(stream);
                                        break;
                                }
-                               LOGD ("  Stream #%d : %s\n", i, gst_stream_get_stream_id(stream));
+                               LOGD("  Stream #%d : %s\n", i, gst_stream_get_stream_id(stream));
                                if (player->track[type].active_track_index == INVALID_TRACK_INDEX) {
                                        int stream_index = INVALID_TRACK_INDEX;
                                        if (_mmplayer_get_track_index(player, type, stream, &stream_index) == MM_ERROR_NONE) {
@@ -3093,6 +3065,7 @@ __mmplayer_gst_find_child_element(GstBin *bin, const gchar *element_name)
                ch_element = NULL;
                g_value_reset(&item);
        }
+       g_value_unset(&item);
        gst_iterator_free(iter);
 
        MMPLAYER_FLEAVE();