diff options
author | Seungha Yang <sh.yang@lge.com> | 2017-01-24 21:32:13 +0900 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-01-31 13:23:34 +0200 |
commit | de86258c9443cffa7a4e78d7df4b5c2c18f640b0 (patch) | |
tree | 88ae4553f53d001d627a956490f7f859c4ef3ca2 /ext | |
parent | e9e6e4a4f64379a28247954277ab311d5b96045e (diff) | |
download | gstreamer-plugins-bad-de86258c9443cffa7a4e78d7df4b5c2c18f640b0.tar.gz |
hls: Exclusion of last three fragment in case of live playback
HLS spec 6.3.3 is saying that
"the client SHOULD NOT choose a segment which starts less than
three target durations from the end of the Playlist file."
To ensure above statement, the third fragment from the end of playlist
should be excluded from seekable range and also from available starting fragment.
(i.e., the fourth fragment from end of playlist is the starting fragment).
https://bugzilla.gnome.org/show_bug.cgi?id=777682
Diffstat (limited to 'ext')
-rw-r--r-- | ext/hls/gsthlsdemux.c | 2 | ||||
-rw-r--r-- | ext/hls/m3u8.c | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c index 44be04e50..f0647fd18 100644 --- a/ext/hls/gsthlsdemux.c +++ b/ext/hls/gsthlsdemux.c @@ -1454,7 +1454,7 @@ retry: "sequence:%" G_GINT64_FORMAT " , first_sequence:%" G_GINT64_FORMAT " , last_sequence:%" G_GINT64_FORMAT, m3u8->sequence, first_sequence, last_sequence); - if (m3u8->sequence >= last_sequence - 3) { + if (m3u8->sequence > last_sequence - 3) { //demux->need_segment = TRUE; /* Make sure we never go below the minimum sequence number */ m3u8->sequence = MAX (first_sequence, last_sequence - 3); diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c index 76cf50f30..eca52914b 100644 --- a/ext/hls/m3u8.c +++ b/ext/hls/m3u8.c @@ -758,11 +758,8 @@ gst_m3u8_update (GstM3U8 * self, gchar * data) file = g_list_last (self->files); /* for live streams, start GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE from - * the end of the playlist. See section 6.3.3 of HLS draft. Note - * the -1, because GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE = 1 means - * start 1 target-duration from the end */ - for (i = 0; i < GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE - 1 && file->prev; - ++i) + * the end of the playlist. See section 6.3.3 of HLS draft */ + for (i = 0; i < GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE && file->prev; ++i) file = file->prev; } else { file = g_list_first (self->files); @@ -1140,7 +1137,7 @@ gst_m3u8_get_seek_range (GstM3U8 * m3u8, gint64 * start, gint64 * stop) } count = g_list_length (m3u8->files); - for (walk = m3u8->files; walk && count >= min_distance; walk = walk->next) { + for (walk = m3u8->files; walk && count > min_distance; walk = walk->next) { file = walk->data; --count; duration += file->duration; |