From: Eunhye Choi Date: Mon, 27 Sep 2021 06:20:14 +0000 (+0900) Subject: [0.6.259] remove invalid object unref X-Git-Tag: submit/tizen/20210928.034031^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F264606%2F2;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git [0.6.259] remove invalid object unref - after calling gst_bin_remove, the element is removed and the reference is cleard too. Change-Id: Iffb267d092160c0b467f32a9aafbc72837ddb2d3 --- diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 25de64a..bb7160b 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -1,6 +1,6 @@ Name: libmm-player Summary: Multimedia Framework Player Library -Version: 0.6.258 +Version: 0.6.259 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_player_gst.c b/src/mm_player_gst.c index e5e3aa4..fb1e493 100644 --- a/src/mm_player_gst.c +++ b/src/mm_player_gst.c @@ -2400,9 +2400,6 @@ __mmplayer_gst_create_es_decoder(mmplayer_t *player, mmplayer_stream_type_e type return FALSE; } - mainbin[elem_id].id = elem_id; - mainbin[elem_id].gst = decodebin; - /* raw pad handling signal */ _mmplayer_add_signal_connection(player, G_OBJECT(decodebin), MM_PLAYER_SIGNAL_TYPE_AUTOPLUG, "pad-added", G_CALLBACK(_mmplayer_gst_decode_pad_added), (gpointer)player); @@ -2443,6 +2440,10 @@ __mmplayer_gst_create_es_decoder(mmplayer_t *player, mmplayer_stream_type_e type gst_object_unref(GST_OBJECT(sinkpad)); gst_element_sync_state_with_parent(decodebin); + + mainbin[elem_id].id = elem_id; + mainbin[elem_id].gst = decodebin; + MMPLAYER_FLEAVE(); return TRUE; @@ -2450,11 +2451,10 @@ ERROR: if (sinkpad) gst_object_unref(GST_OBJECT(sinkpad)); - if (mainbin[elem_id].gst) { - gst_element_set_state(mainbin[elem_id].gst, GST_STATE_NULL); - gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[elem_id].gst); - gst_object_unref(mainbin[elem_id].gst); - mainbin[elem_id].gst = NULL; + if (decodebin) { + gst_element_set_state(decodebin, GST_STATE_NULL); + if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin)) + gst_object_unref(decodebin); } MMPLAYER_FLEAVE(); @@ -2588,15 +2588,15 @@ __mmplayer_gst_create_es_path(mmplayer_t *player, mmplayer_stream_type_e type, G ERROR: if (mainbin[src_id].gst) { gst_element_set_state(mainbin[src_id].gst, GST_STATE_NULL); - gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[src_id].gst); - gst_object_unref(mainbin[src_id].gst); + if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[src_id].gst)) + gst_object_unref(mainbin[src_id].gst); mainbin[src_id].gst = NULL; } if (mainbin[queue_id].gst) { gst_element_set_state(mainbin[queue_id].gst, GST_STATE_NULL); - gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[queue_id].gst); - gst_object_unref(mainbin[queue_id].gst); + if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), mainbin[queue_id].gst)) + gst_object_unref(mainbin[queue_id].gst); mainbin[queue_id].gst = NULL; } diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index d75a7d8..89c47fc 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -6311,8 +6311,10 @@ ERROR: /* And, it still has a parent "player". * You need to let the parent manage the object instead of unreffing the object directly. */ - gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue2); - gst_object_unref(queue2); + if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), queue2)) { + LOGE("failed to remove queue2"); + gst_object_unref(queue2); + } queue2 = NULL; } @@ -6327,8 +6329,10 @@ ERROR: * You need to let the parent manage the object instead of unreffing the object directly. */ - gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin); - gst_object_unref(decodebin); + if (!gst_bin_remove(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin)) { + LOGE("failed to remove decodebin"); + gst_object_unref(decodebin); + } decodebin = NULL; } @@ -6744,7 +6748,11 @@ __mmplayer_deactivate_selector(mmplayer_t *player, mmplayer_track_type_e type) g_ptr_array_set_size(selector->streams, 0); gst_element_set_state(player->pipeline->mainbin[selectorId].gst, GST_STATE_NULL); - gst_bin_remove(GST_BIN_CAST(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), player->pipeline->mainbin[selectorId].gst); + if (!gst_bin_remove(GST_BIN_CAST(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), + player->pipeline->mainbin[selectorId].gst)) { + LOGE("failed to remove selector"); + gst_object_unref(player->pipeline->mainbin[selectorId].gst); + } player->pipeline->mainbin[selectorId].gst = NULL; selector = NULL; @@ -7540,7 +7548,6 @@ _mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad *pad, mmplayer_t *player = (mmplayer_t *)data; mmplayer_gst_element_t *mainbin = player->pipeline->mainbin; mmplayer_gst_element_t *videobin = player->pipeline->videobin; - gint timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player); MMPLAYER_FENTER(); MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && mainbin); @@ -7557,29 +7564,16 @@ _mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad *pad, if (!gst_bin_remove(GST_BIN_CAST(mainbin[MMPLAYER_M_PIPE].gst), videobin[MMPLAYER_V_BIN].gst)) { LOGE("failed to remove videobin"); + gst_object_unref(GST_OBJECT(videobin[MMPLAYER_V_BIN].gst)); } if (!gst_bin_remove(GST_BIN_CAST(mainbin[MMPLAYER_M_PIPE].gst), mainbin[MMPLAYER_M_V_CONCAT].gst)) { LOGE("failed to remove video concat"); + gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_V_CONCAT].gst)); } - ret = _mmplayer_gst_set_state(player, videobin[MMPLAYER_V_BIN].gst, GST_STATE_NULL, FALSE, timeout); - if (ret != MM_ERROR_NONE) { - LOGE("fail to change state to NULL"); - return; - } - - ret = _mmplayer_gst_set_state(player, mainbin[MMPLAYER_M_V_CONCAT].gst, GST_STATE_NULL, FALSE, timeout); - if (ret != MM_ERROR_NONE) { - LOGE("fail to change state to NULL"); - return; - } - - gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_V_CONCAT].gst)); mainbin[MMPLAYER_M_V_CONCAT].gst = NULL; mainbin[MMPLAYER_M_V_CONCAT].id = 0; - - gst_object_unref(GST_OBJECT(videobin[MMPLAYER_V_BIN].gst)); MMPLAYER_FREEIF(player->pipeline->videobin); ret = __mmplayer_release_hw_resource(player, MMPLAYER_RESOURCE_TYPE_VIDEO_OVERLAY);