[0.6.266] release video resource
[platform/core/multimedia/libmm-player.git] / src / mm_player_priv.c
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));