[0.6.122] adjust the timeout in case of pd 36/185836/3 accepted/tizen/unified/20180807.132234 submit/tizen/20180806.055314
authorEunhae Choi <eunhae1.choi@samsung.com>
Fri, 3 Aug 2018 02:06:52 +0000 (11:06 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Fri, 3 Aug 2018 02:34:07 +0000 (11:34 +0900)
- increase the timeout
  during player_start(), download pipeline will be building
  before changing the playback pipeline state to PLAYING.
- add handling the async value of sink elem when stop operation
  in case of pd and es push.
  there could be no media data for async state changing.

Change-Id: Ifb89c39c5e2290638def6402a722fabe7f9b7069

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

index 635d1b3..fc6249f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.121
+Version:    0.6.122
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 23a1d7e..3d1249c 100644 (file)
@@ -112,10 +112,11 @@ enum content_attr_flag {
        ATTR_ALL = 0x0020,
 };
 
-/* async mode makes trouble. alsasink sometimes fails to pause. */
-enum alassink_sync {
-       ALSASINK_SYNC,
-       ALSASINK_ASYNC
+enum MMPlayerSinkType {
+       MMPLAYER_VIDEO_SINK = 0x01,
+       MMPLAYER_AUDIO_SINK = 0x02,
+       MMPLAYER_TEXT_SINK = 0x04,
+       MMPLAYER_SINK_ALL = 0x07,
 };
 
 /**
index 5102b47..9fb8a3b 100644 (file)
@@ -247,6 +247,7 @@ static void         __mmplayer_audio_stream_send_data(mm_player_t* player, mm_player_au
 static void            __mmplayer_initialize_storage_info(mm_player_t* player, MMPlayerPathType path_type);
 static void            __mmplayer_get_metadata_360_from_tags(GstTagList *tags, mm_player_spherical_metadata_t *metadata);
 static int             __resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res, void *user_data);
+static void            __mmplayer_gst_handle_async(mm_player_t* player, gboolean async, enum MMPlayerSinkType type);
 
 /*===========================================================================================
 |                                                                                                                                                                                      |
@@ -917,7 +918,7 @@ __mmplayer_drop_subtitle(mm_player_t* player, gboolean is_drop)
        if (is_drop) {
                LOGD("Drop subtitle text after getting EOS\n");
 
-               g_object_set(textbin[MMPLAYER_T_FAKE_SINK].gst, "async", FALSE, NULL);
+               __mmplayer_gst_handle_async(player, FALSE, MMPLAYER_TEXT_SINK);
                g_object_set(textbin[MMPLAYER_T_IDENTITY].gst, "drop-probability", (gfloat)1.0, NULL);
 
                player->is_subtitle_force_drop = TRUE;
@@ -926,7 +927,7 @@ __mmplayer_drop_subtitle(mm_player_t* player, gboolean is_drop)
                        LOGD("Enable subtitle data path without drop\n");
 
                        g_object_set(textbin[MMPLAYER_T_IDENTITY].gst, "drop-probability", (gfloat)0.0, NULL);
-                       g_object_set(textbin[MMPLAYER_T_FAKE_SINK].gst, "async", TRUE, NULL);
+                       __mmplayer_gst_handle_async(player, TRUE, MMPLAYER_TEXT_SINK);
 
                        LOGD("non-connected with external display");
 
@@ -2702,7 +2703,6 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
                                        goto ERROR;
                                }
 
-                               g_object_set(G_OBJECT(fakesink), "async", TRUE, NULL);
                                g_object_set(G_OBJECT(fakesink), "sync", TRUE, NULL);
                                gst_element_set_state(fakesink, GST_STATE_PAUSED);
 
@@ -5608,7 +5608,6 @@ static int __mmplayer_gst_create_plain_text_elements(mm_player_t* player)
                                                        G_CALLBACK(__mmplayer_update_subtitle),
                                                        (gpointer)player);
 
-       g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "async", TRUE, NULL);
        g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "sync", TRUE, NULL);
        g_object_set(G_OBJECT(textbin[MMPLAYER_T_FAKE_SINK].gst), "signal-handoffs", TRUE, NULL);
 
@@ -7085,6 +7084,30 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player)
        return ret;
 }
 
+static void __mmplayer_gst_handle_async(mm_player_t* player, gboolean async, enum MMPlayerSinkType type)
+{
+       MMPlayerGstElement *videobin = NULL, *audiobin = NULL, *textbin = NULL;
+
+       MMPLAYER_RETURN_IF_FAIL(player && player->pipeline);
+
+       audiobin = player->pipeline->audiobin; /* can be null */
+       videobin = player->pipeline->videobin; /* can be null */
+       textbin = player->pipeline->textbin;   /* can be null */
+
+       LOGD("Async will be set to %d about 0x%X type sink", async, type);
+
+       if ((type & MMPLAYER_AUDIO_SINK) && audiobin && audiobin[MMPLAYER_A_SINK].gst)
+               g_object_set(audiobin[MMPLAYER_A_SINK].gst, "async", async, NULL);
+
+       if ((type & MMPLAYER_VIDEO_SINK) && videobin && videobin[MMPLAYER_V_SINK].gst)
+               g_object_set(videobin[MMPLAYER_V_SINK].gst, "async", async, NULL);
+
+       if ((type & MMPLAYER_TEXT_SINK) && textbin && textbin[MMPLAYER_T_FAKE_SINK].gst)
+               g_object_set(textbin[MMPLAYER_T_FAKE_SINK].gst, "async", async, NULL);
+
+       return;
+}
+
 static int __gst_realize(mm_player_t* player)
 {
        gint timeout = 0;
@@ -7248,7 +7271,6 @@ static int __gst_stop(mm_player_t* player)
        gboolean rewind = FALSE;
        gint timeout = 0;
        int ret = MM_ERROR_NONE;
-       gboolean async = FALSE;
 
        MMPLAYER_FENTER();
 
@@ -7272,10 +7294,18 @@ static int __gst_stop(mm_player_t* player)
                (player->streaming_type == STREAMING_SERVICE_VOD && player->videodec_linked))
                rewind = TRUE;
 
-       if (player->es_player_push_mode)
-               async = TRUE;
+       if (player->es_player_push_mode || MMPLAYER_IS_HTTP_PD(player)) {
+               /* disable the async state transition because there could be no data in the pipeline */
+               __mmplayer_gst_handle_async(player, FALSE, MMPLAYER_SINK_ALL);
+       }
+
        /* set gst state */
-       ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED, async, timeout);
+       ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED, FALSE, timeout);
+
+       if (player->es_player_push_mode || MMPLAYER_IS_HTTP_PD(player)) {
+               /* enable the async state transition as default operation */
+               __mmplayer_gst_handle_async(player, TRUE, MMPLAYER_SINK_ALL);
+       }
 
        /* return if set_state has failed */
        if (ret != MM_ERROR_NONE) {
@@ -13357,7 +13387,9 @@ int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout)
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
        MMPLAYER_RETURN_VAL_IF_FAIL(timeout, MM_ERROR_COMMON_INVALID_ARGUMENT);
 
-       if (MMPLAYER_IS_STREAMING(player))
+       if (MMPLAYER_IS_HTTP_PD(player))
+               *timeout = player->ini.live_state_change_timeout*2;
+       else if (MMPLAYER_IS_STREAMING(player))
                *timeout = player->ini.live_state_change_timeout;
        else
                *timeout = player->ini.localplayback_state_change_timeout;