[0.6.280] set buffering criteria on adaptivedemux2 80/294480/3
authorEunhye Choi <eunhae1.choi@samsung.com>
Tue, 20 Jun 2023 04:59:24 +0000 (13:59 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Tue, 20 Jun 2023 06:04:06 +0000 (15:04 +0900)
- adaptivedemux2 is used for buffering in urideocdebin3
  so the buffering criteria for adaptive streaming
  have to be set on adaptivedemux2 plugin instead of queue

Change-Id: I6b8ef9176eaefae035107d6b41493553ff652195

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

index 070e019..7d66209 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.279
+Version:    0.6.280
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index b85e693..6eba4df 100644 (file)
 
 #define MMPLAYER_FREEIF(x) \
        do {    \
-               if (x) { \
-                       g_free(x); \
-                       x = NULL;       \
-               } \
+               g_clear_pointer(&x, g_free); \
        } while (0)
 
 #define MMPLAYER_GET_ATTRS(x_player) ((mmplayer_t *)x_player)->attrs
index 7a88a4e..c3fb4d0 100644 (file)
@@ -977,14 +977,22 @@ __mmplayer_update_buffer_setting(mmplayer_t *player, GstMessage *buffering_msg)
 
        _mmplayer_gst_get_position(player, &pos_nsec);  /* to update player->last_position */
 
-       if (MMPLAYER_IS_HTTP_STREAMING(player)) {
+       if (MMPLAYER_IS_HTTP_STREAMING(player))
                data_size = player->http_content_size;
-       }
 
        _mm_player_streaming_buffering(player->streamer, buffering_msg, data_size, player->last_position, player->duration);
-       _mm_player_streaming_sync_property(player->streamer, player->pipeline->mainbin[MMPLAYER_M_AUTOPLUG].gst);
+       if (!player->streamer->is_adaptive_streaming) {
+               _mm_player_streaming_sync_property(player->streamer, player->pipeline->mainbin[MMPLAYER_M_AUTOPLUG].gst);
+               return;
+       }
 
-       return;
+       /* adaptivedemux2 is used for buffering in uridecodebin3 */
+       if (!player->streamer->buffering_req.is_pre_buffering) {
+               LOGD("adaptive> set rebuffer time : %d ms", player->streamer->buffering_req.rebuffer_time);
+               g_object_set(player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst,
+                       "low-watermark-time", (guint64)(player->streamer->buffering_req.rebuffer_time * GST_MSECOND),
+                       NULL);
+       }
 }
 
 static int
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);
index 4a1735e..2928562 100644 (file)
@@ -760,7 +760,7 @@ static void __streaming_update_buffering_status(mmplayer_streaming_t *streamer,
                streamer->buffering_state = MM_PLAYER_BUFFERING_IN_PROGRESS;
                streamer->buffering_percent = -1;
 
-               if (!streamer->buffering_req.is_pre_buffering) {
+               if (!streamer->buffering_req.is_pre_buffering && !streamer->is_adaptive_streaming) {
                        streamer->need_update = TRUE;
                        __streaming_adjust_min_threshold(streamer, position);
                }
@@ -806,7 +806,8 @@ void _mm_player_streaming_buffering(mmplayer_streaming_t *streamer, GstMessage *
        }
 
        streamer->need_update = FALSE;
-       __streaming_update_buffer_setting(streamer, buffering_msg, content_size, position, duration);
+       if (!streamer->is_adaptive_streaming)
+               __streaming_update_buffer_setting(streamer, buffering_msg, content_size, position, duration);
 
        return;
 }