[0.6.280] set buffering criteria on adaptivedemux2
[platform/core/multimedia/libmm-player.git] / src / mm_player_priv.c
index 2453a5b..64aa9b9 100644 (file)
@@ -7805,13 +7805,35 @@ _mmplayer_gst_element_added(GstBin *bin, GstElement *element, gpointer data)
                        player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].id = MMPLAYER_M_ADAPTIVE_DEMUX;
                        player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst = element;
 
-                       LOGD("set max variant limit: %d, %d %d", player->adaptive_info.limit.bandwidth,
-                                                       player->adaptive_info.limit.width, player->adaptive_info.limit.height);
+                       MMPLAYER_FREEIF(player->type);
+
+                       if (g_strrstr(factory_name, "hlsdemux")) {
+                               player->type = g_strdup("application/x-hls");
+                               player->profile.uri_type = MM_PLAYER_URI_TYPE_HLS;
+                       } else if (g_strrstr(factory_name, "dashdemux")) {
+                               player->type = g_strdup("application/dash+xml");
+                               player->profile.uri_type = MM_PLAYER_URI_TYPE_DASH;
+                       } else {
+                               LOGE("not supported type");
+                               return;
+                       }
+                       player->streamer->is_adaptive_streaming = TRUE;
+
+                       if (player->streamer->buffering_req.prebuffer_time <= MIN_BUFFERING_TIME)
+                               player->streamer->buffering_req.prebuffer_time = DEFAULT_PREBUFFERING_TIME;
+
+                       LOGD("max variant limit: %d, %d, %d, prebuffer time: %d ms",
+                               player->adaptive_info.limit.bandwidth,
+                               player->adaptive_info.limit.width,
+                               player->adaptive_info.limit.height,
+                               player->streamer->buffering_req.prebuffer_time);
 
                        g_object_set(player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst,
-                                                       "max-bandwidth", player->adaptive_info.limit.bandwidth,
-                                                       "max-video-width", player->adaptive_info.limit.width,
-                                                       "max-video-height", player->adaptive_info.limit.height, NULL);
+                               "max-bandwidth", player->adaptive_info.limit.bandwidth,
+                               "max-video-width", player->adaptive_info.limit.width,
+                               "max-video-height", player->adaptive_info.limit.height,
+                               "low-watermark-time", (guint64)(player->streamer->buffering_req.prebuffer_time * GST_MSECOND),
+                               NULL);
                } else {
 #ifdef __DEBUG__
                        LOGD("plugged element is demuxer. take it");
@@ -7837,9 +7859,7 @@ _mmplayer_gst_element_added(GstBin *bin, GstElement *element, gpointer data)
                player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].id = MMPLAYER_M_DEMUXED_S_BUFFER;
                player->pipeline->mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst = element;
 
-               if ((MMPLAYER_IS_HTTP_STREAMING(player)) ||
-                       (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) ||
-                       (MMPLAYER_IS_DASH_STREAMING(player))) {
+               if (MMPLAYER_IS_HTTP_STREAMING(player)) {
                        /* in case of multiqueue, max bytes size is defined with fixed value in mm_player_streaming.h*/
                        _mm_player_streaming_set_multiqueue(player->streamer, element);
                        _mm_player_streaming_sync_property(player->streamer, player->pipeline->mainbin[MMPLAYER_M_AUTOPLUG].gst);