diff options
author | Hosang Lee <hosang10.lee@lge.com> | 2020-06-16 12:42:16 +0900 |
---|---|---|
committer | Hosang Lee <hosang10.lee@lge.com> | 2020-08-10 16:13:30 +0900 |
commit | d9dda36e02c82eb91a6b946d9a2a66c71ecef00b (patch) | |
tree | 2206e757063778a2e083926d2f318a0722325fec | |
parent | 1d1b3eb8b48d421e28004a18b3f44b13d4b20861 (diff) |
smoothstreaming: start closer to the edge in live streams
It is more appropriate to start closer to the live edge in
live streams. Some live streams maintain a large dvr window
(over few hours in some cases), so starting from the first
fragment will be too far away from the live edge.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1346>
-rw-r--r-- | ext/smoothstreaming/gstmssmanifest.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/ext/smoothstreaming/gstmssmanifest.c b/ext/smoothstreaming/gstmssmanifest.c index 5d195eb99..0ab4096e3 100644 --- a/ext/smoothstreaming/gstmssmanifest.c +++ b/ext/smoothstreaming/gstmssmanifest.c @@ -54,6 +54,8 @@ GST_DEBUG_CATEGORY_EXTERN (mssdemux_debug); #define MSS_PROP_TIMESCALE "TimeScale" #define MSS_PROP_URL "Url" +#define GST_MSSMANIFEST_LIVE_MIN_FRAGMENT_DISTANCE 3 + typedef struct _GstMssStreamFragment { guint number; @@ -286,7 +288,21 @@ _gst_mss_stream_init (GstMssManifest * manifest, GstMssStream * stream, if (builder.fragments) { stream->fragments = g_list_reverse (builder.fragments); - stream->current_fragment = stream->fragments; + if (manifest->is_live) { + GList *iter = g_list_last (stream->fragments); + gint i; + + for (i = 0; i < GST_MSSMANIFEST_LIVE_MIN_FRAGMENT_DISTANCE; i++) { + if (g_list_previous (iter)) { + iter = g_list_previous (iter); + } else { + break; + } + } + stream->current_fragment = iter; + } else { + stream->current_fragment = stream->fragments; + } } /* order them from smaller to bigger based on bitrates */ |