X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmm_player_priv.c;h=b8946c5ae2b2b25239c29ecbea081ab3d931bf71;hb=ded1b6c53bf8b4dea50d516cd4e3ebc1db741252;hp=c25a6fc9217141719d52049924b999aa0f44054e;hpb=dd438bfa136120bdb1113ac73241ae43f1e5b022;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index c25a6fc..b8946c5 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); } @@ -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)); @@ -9310,9 +9318,6 @@ __mmplayer_update_audio_attrs(mmplayer_t *player, MMHandleType attrs) } p = gst_caps_get_structure(caps_a, 0); - - mm_attrs_get_int_by_name(attrs, "content_audio_samplerate", &samplerate); - gst_structure_get_int(p, "rate", &samplerate); gst_structure_get_int(p, "channels", &channels);