From: Younghwan Ahn Date: Fri, 12 Apr 2013 07:15:38 +0000 (+0900) Subject: remove retry to get duration X-Git-Tag: 2.1b_release~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bce6b16440543b835065c361d246cf3512ec6d8d;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git remove retry to get duration Change-Id: Ied4dedc42035f06c7efc7b71a5facb3d0bf97201 --- diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 434662c..bdeb348 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.2.17 +Version: 0.2.18 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index 185fc23..2d385b6 100755 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -577,8 +577,6 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag) gint64 dur_nsec = 0; GstStructure* p = NULL; MMHandleType attrs = 0; - gint retry_count = 0; - gint retry_count_max = 10; gchar *path = NULL; gint stream_service_type = STREAMING_SERVICE_NONE; struct stat sb; @@ -633,38 +631,12 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag) debug_log("try to update duration"); has_duration = FALSE; - /* update duration - * NOTE : we need to wait for a while until is possible to get duration from pipeline - * as getting duration timing is depends on behavier of demuxers ( or etc ). - * we set timeout 100ms * 10 as initial value. fix it if needed. - */ - while ( retry_count < retry_count_max) + if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &fmt, &dur_nsec )) { - if ( FALSE == gst_element_query_duration( - player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &fmt, &dur_nsec ) ) - { - /* retry if failed */ - debug_warning("failed to get duraton. waiting 100ms and then retrying..."); - usleep(100000); - retry_count++; - continue; - } - - if ( dur_nsec == 0 && ( !MMPLAYER_IS_LIVE_STREAMING( player ) ) ) - { - /* abnormal situation. try again if duration is zero in case of not live stream */ - debug_warning("returned duration is zero. but it's not an live stream. retrying..."); - usleep(100000); - retry_count++; - continue; - } - - break; + player->duration = dur_nsec; + debug_log("duration : %lld msec", GST_TIME_AS_MSECONDS(dur_nsec)); } - player->duration = dur_nsec; - debug_log("duration : %lld msec", GST_TIME_AS_MSECONDS(dur_nsec)); - /* try to get streaming service type */ stream_service_type = __mmplayer_get_stream_service_type( player ); mm_attrs_set_int_by_name ( attrs, "streaming_type", stream_service_type ); @@ -672,14 +644,14 @@ _mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag) /* check duration is OK */ if ( dur_nsec == 0 && !MMPLAYER_IS_LIVE_STREAMING( player ) ) { - /* FIXIT : find another way to get duration here. */ - debug_error("finally it's failed to get duration from pipeline. progressbar will not work correctely!"); + debug_error("not ready to get duration"); } else { /*update duration */ mm_attrs_set_int_by_name(attrs, "content_duration", GST_TIME_AS_MSECONDS(dur_nsec)); has_duration = TRUE; + debug_log("duration updated"); } }