X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmm_player_priv.c;h=6e3f150750994fbf698c236b35c4e92999b92888;hb=refs%2Fchanges%2F92%2F257192%2F1;hp=d6b84e9757ccf897c2a2785232c6fdd41358efb0;hpb=014082dd67173b64ea2c1121b6473ac61b49bb87;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index d6b84e9..6e3f150 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -3273,6 +3273,7 @@ __mmplayer_video_stream_get_bo(mmplayer_t *player, int size) GList *l = NULL; MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL); gboolean ret = TRUE; + gint64 end_time = 0; /* check DRC, if it is, destroy the prev bo list to create again */ if (player->video_bo_size != size) { @@ -3325,6 +3326,9 @@ __mmplayer_video_stream_get_bo(mmplayer_t *player, int size) } } + if (player->ini.video_bo_timeout > 0) + end_time = g_get_monotonic_time() + player->ini.video_bo_timeout * G_TIME_SPAN_SECOND; + while (TRUE) { /* get bo from list*/ for (l = g_list_first(player->video_bo_list); l; l = g_list_next(l)) { @@ -3336,20 +3340,20 @@ __mmplayer_video_stream_get_bo(mmplayer_t *player, int size) return tbm_bo_ref(tmp->bo); } } - if (!ret) { - LOGE("failed to get bo in %d timeout", player->ini.video_bo_timeout); - MMPLAYER_VIDEO_BO_UNLOCK(player); - return NULL; - } if (player->ini.video_bo_timeout <= 0) { MMPLAYER_VIDEO_BO_WAIT(player); } else { - gint64 timeout = g_get_monotonic_time() + player->ini.video_bo_timeout * G_TIME_SPAN_SECOND; - ret = MMPLAYER_VIDEO_BO_WAIT_UNTIL(player, timeout); + ret = MMPLAYER_VIDEO_BO_WAIT_UNTIL(player, end_time); + if (!ret) { + LOGE("failed to get bo in %d timeout", player->ini.video_bo_timeout); + break; + } } - continue; } + + MMPLAYER_VIDEO_BO_UNLOCK(player); + return NULL; } static void @@ -4369,9 +4373,6 @@ __mmplayer_gst_destroy_pipeline(mmplayer_t *player) __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_ALL); if (mainbin) { - mmplayer_gst_element_t *audiobin = player->pipeline->audiobin; - mmplayer_gst_element_t *videobin = player->pipeline->videobin; - mmplayer_gst_element_t *textbin = player->pipeline->textbin; GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(mainbin[MMPLAYER_M_PIPE].gst)); gst_bus_set_sync_handler(bus, NULL, NULL, NULL); gst_object_unref(bus); @@ -4391,9 +4392,9 @@ __mmplayer_gst_destroy_pipeline(mmplayer_t *player) if (mainbin[MMPLAYER_M_SRC_FAKESINK].gst) gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_SRC_FAKESINK].gst)); - MMPLAYER_FREEIF(audiobin); - MMPLAYER_FREEIF(videobin); - MMPLAYER_FREEIF(textbin); + MMPLAYER_FREEIF(player->pipeline->audiobin); + MMPLAYER_FREEIF(player->pipeline->videobin); + MMPLAYER_FREEIF(player->pipeline->textbin); MMPLAYER_FREEIF(mainbin); } @@ -4619,6 +4620,8 @@ __resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res, player->interrupted_by_resource = TRUE; + MMPLAYER_POST_MSG(player, MM_MESSAGE_INTERRUPT_STARTED, NULL); + /* get last play position */ if (_mmplayer_gst_get_position(player, &pos) == MM_ERROR_NONE) { msg.union_type = MM_MSG_UNION_TIME; @@ -4628,8 +4631,6 @@ __resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res, LOGW("failed to get play position."); } - MMPLAYER_POST_MSG(player, MM_MESSAGE_FLUSH_BUFFER, NULL); - LOGD("video resource conflict so, resource will be freed by unrealizing"); if (_mmplayer_unrealize((MMHandleType)player) != MM_ERROR_NONE) LOGE("failed to unrealize"); @@ -6930,8 +6931,13 @@ _mmplayer_gst_decode_autoplug_continue(GstElement *bin, GstPad *pad, MMPLAYER_FREEIF(caps_str); } else if (g_str_has_prefix(mime, "video") && player->videodec_linked) { - LOGD("already video linked"); - ret = FALSE; + if((MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) || (MMPLAYER_IS_DASH_STREAMING(player))) { + LOGD("video is already linked, allow the stream switch"); + ret = TRUE; + } else { + LOGD("video is already linked"); + ret = FALSE; + } } else { LOGD("found new stream"); } @@ -7508,10 +7514,14 @@ _mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad *pad, if (!videobin || !g_str_has_prefix(GST_PAD_NAME (pad), "video")) 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; + __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_VIDEOBIN); + + if (!gst_bin_remove(GST_BIN_CAST(mainbin[MMPLAYER_M_PIPE].gst), videobin[MMPLAYER_V_BIN].gst)) { + LOGE("failed to remove videobin"); + } + + if (!gst_bin_remove(GST_BIN_CAST(mainbin[MMPLAYER_M_PIPE].gst), mainbin[MMPLAYER_M_V_CONCAT].gst)) { + LOGE("failed to remove video concat"); } ret = _mmplayer_gst_set_state(player, videobin[MMPLAYER_V_BIN].gst, GST_STATE_NULL, FALSE, timeout); @@ -7520,12 +7530,10 @@ _mmplayer_gst_decode_pad_removed(GstElement *elem, GstPad *pad, 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"); - } - - if (!gst_bin_remove(GST_BIN_CAST(mainbin[MMPLAYER_M_PIPE].gst), videobin[MMPLAYER_V_BIN].gst)) { - LOGE("failed to remove videobin"); + 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));