diff options
author | Alex Ashley <bugzilla@ashley-family.net> | 2015-11-10 16:19:34 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-12-02 10:16:25 +0200 |
commit | 0745d567a7959e01b4308c0971134d5c3d272c39 (patch) | |
tree | a136a4e2761bc985f07e03acfdf3baf6b51fb53d /ext | |
parent | ce67e8934de20d6d7b9814cb36b2a12c545339fe (diff) | |
download | gstreamer-plugins-bad-0745d567a7959e01b4308c0971134d5c3d272c39.tar.gz |
hlsdemux: correct the calculation of seek range of non-live streams
The seek range calculation for on-demand streams was incorrectly
excluding the last three segments of the stream. This three segment
rule should only be applied to live streams [1].
[1] https://tools.ietf.org/html/draft-pantos-http-live-streaming-17#section-6.3.3
https://bugzilla.gnome.org/show_bug.cgi?id=758386
Diffstat (limited to 'ext')
-rw-r--r-- | ext/hls/m3u8.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c index c49f4337f..a70bc747d 100644 --- a/ext/hls/m3u8.c +++ b/ext/hls/m3u8.c @@ -1345,6 +1345,7 @@ gst_m3u8_client_get_seek_range (GstM3U8Client * client, gint64 * start, GList *walk; GstM3U8MediaFile *file; guint count; + guint min_distance = 0; g_return_val_if_fail (client != NULL, FALSE); @@ -1355,13 +1356,16 @@ gst_m3u8_client_get_seek_range (GstM3U8Client * client, gint64 * start, return FALSE; } + if (GST_M3U8_CLIENT_IS_LIVE (client)) { + /* min_distance is used to make sure the seek range is never closer than + GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE fragments from the end of a live + playlist - see 6.3.3. "Playing the Playlist file" of the HLS draft */ + min_distance = GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE; + } count = g_list_length (client->current->files); - /* count is used to make sure the seek range is never closer than - GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE fragments from the end of the - playlist - see 6.3.3. "Playing the Playlist file" of the HLS draft */ for (walk = client->current->files; - walk && count >= GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE; walk = walk->next) { + walk && count >= min_distance; walk = walk->next) { file = walk->data; --count; duration += file->duration; |