summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAthanasios Oikonomou <athoik@gmail.com>2015-08-07 12:53:23 +0300
committerSebastian Dröge <sebastian@centricular.com>2015-08-26 12:11:57 +0300
commit22456ce0328a8d06a12997979a143a0103867a49 (patch)
tree5f55bc5882d261c67b256298baf7eab594116086 /ext
parentae6f4a261bf1af9787d09419d339d7ffd1e2be8a (diff)
downloadgstreamer-plugins-bad-22456ce0328a8d06a12997979a143a0103867a49.tar.gz
hlsdemux: select correct position for live streams that don't remove fragments
Some live streams (eg youtube) don't remove fragments in order to allow seeking back in time (live + vod). When gst_m3u8_client_has_next_fragment is called, we are getting wrong fragment because current_file points in first file of the fragments list resulting in watching the stream from the beginning again. This patch sets current_file to nth fragment for live streams, then on gst_m3u8_client_has_next_fragment will keep up with the live stream. https://bugzilla.gnome.org/show_bug.cgi?id=753344
Diffstat (limited to 'ext')
-rwxr-xr-xext/hls/m3u8.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c
index 1273b7101..b931749fa 100755
--- a/ext/hls/m3u8.c
+++ b/ext/hls/m3u8.c
@@ -853,17 +853,16 @@ gst_m3u8_client_update (GstM3U8Client * self, gchar * data)
}
if (m3u8->files && self->sequence == -1) {
- self->current_file = g_list_first (m3u8->files);
if (GST_M3U8_CLIENT_IS_LIVE (self)) {
/* for live streams, start GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE from
the end of the playlist. See section 6.3.3 of HLS draft */
gint pos =
g_list_length (m3u8->files) - GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE;
- self->sequence =
- GST_M3U8_MEDIA_FILE (g_list_nth_data (m3u8->files,
- pos >= 0 ? pos : 0))->sequence;
- } else
- self->sequence = GST_M3U8_MEDIA_FILE (self->current_file->data)->sequence;
+ self->current_file = g_list_nth (m3u8->files, pos >= 0 ? pos : 0);
+ } else {
+ self->current_file = g_list_first (m3u8->files);
+ }
+ self->sequence = GST_M3U8_MEDIA_FILE (self->current_file->data)->sequence;
self->sequence_position = 0;
GST_DEBUG ("Setting first sequence at %u", (guint) self->sequence);
}