[0.6.266] release video resource 96/265396/1 accepted/tizen/unified/20211101.140247 submit/tizen/20211028.044502
authorEunhye Choi <eunhae1.choi@samsung.com>
Mon, 18 Oct 2021 06:54:24 +0000 (15:54 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Mon, 18 Oct 2021 06:54:27 +0000 (15:54 +0900)
- set state to NULL to release resource before remove from bin
- object unref is done in gst_bin_remove.

Change-Id: Ib943eeb5e65c2dcf84087df92620a56df287f680

packaging/libmm-player.spec
src/mm_player_priv.c

index 31abe7c..49575ac 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.265
+Version:    0.6.266
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 73e60b4..b936df4 100644 (file)
@@ -7585,6 +7585,7 @@ _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);
@@ -7601,11 +7602,27 @@ _mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad *pad,
 
        __mmplayer_del_sink(player, videobin[MMPLAYER_V_SINK].gst);
 
+       LOGD("remove videobin");
+       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 of videobin to NULL");
+               return;
+       }
+
        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));
        }
 
+       LOGD("remove concat");
+       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 of concat to NULL");
+               return;
+       }
+
        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));