diff options
author | Jan Alexander Steffens (heftig) <jsteffens@make.tv> | 2017-09-27 09:27:12 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-10-19 15:47:04 +0200 |
commit | 7690a4a521c15d0b5490b4f29bed715e8b74b417 (patch) | |
tree | 2bc76ce562fee166b5285b47b9dd19f8950e82f2 /ext/hls/m3u8.c | |
parent | 025633b16278a49a30d9b4fe0120a7470d7a07bd (diff) | |
download | gstreamer-plugins-bad-7690a4a521c15d0b5490b4f29bed715e8b74b417.tar.gz |
m3u8: Don't try to match URIs when we have media sequences
It is legal for a stream to reuse segments (marking discontinuities as
needed). Uplynk delivers such playlists for their placeholder loops.
Leave the URI scanning in place for playlists which have no
EXT-X-MEDIA-SEQUENCE tag. This should be harmless since the spec
requires these playlists to not be missing segments (RFC8216 6.2.2),
so we should be always matching on the first segment.
https://bugzilla.gnome.org/show_bug.cgi?id=788417
Diffstat (limited to 'ext/hls/m3u8.c')
-rw-r--r-- | ext/hls/m3u8.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c index 654067cd5..ced02116b 100644 --- a/ext/hls/m3u8.c +++ b/ext/hls/m3u8.c @@ -321,8 +321,8 @@ check_media_seqnums (GstM3U8 * self, GList * previous_files) return TRUE; } - /* Find first case of higher/equal sequence number in new playlist or - * same URI. From there on we can linearly step ahead */ + /* Find first case of higher/equal sequence number in new playlist. + * From there on we can linearly step ahead */ for (l = self->files; l; l = l->next) { gboolean match = FALSE; @@ -330,7 +330,7 @@ check_media_seqnums (GstM3U8 * self, GList * previous_files) for (m = previous_files; m; m = m->next) { f2 = m->data; - if (f1->sequence >= f2->sequence || g_str_equal (f1->uri, f2->uri)) { + if (f1->sequence >= f2->sequence) { match = TRUE; break; } @@ -345,7 +345,7 @@ check_media_seqnums (GstM3U8 * self, GList * previous_files) if (!l) { /* No match, no sequence in the new playlist was higher than - * any in the old, and no URI was found again. This is bad! */ + * any in the old. This is bad! */ GST_ERROR ("Media sequences inconsistent, ignoring"); return FALSE; } @@ -354,27 +354,16 @@ check_media_seqnums (GstM3U8 * self, GList * previous_files) f1 = l->data; f2 = m->data; - if (f1->sequence == f2->sequence) { - if (!g_str_equal (f1->uri, f2->uri)) { - /* Same sequence, different URI. This is bad! */ - GST_ERROR ("Media sequences inconsistent, ignoring"); - return FALSE; - } else { - /* Good case, we advance and check the next one */ - } - } else if (g_str_equal (f1->uri, f2->uri)) { - /* Same URIs but different sequences, this is bad! */ + if (f1->sequence == f2->sequence && !g_str_equal (f1->uri, f2->uri)) { + /* Same sequence, different URI. This is bad! */ + GST_ERROR ("Media sequences inconsistent, ignoring"); + return FALSE; + } else if (f1->sequence < f2->sequence) { + /* Not same sequence but by construction sequence must be higher in the + * new one. All good in that case, if it isn't then this means that + * sequence numbers are decreasing or files were inserted */ GST_ERROR ("Media sequences inconsistent, ignoring"); return FALSE; - } else { - /* Not same URI, not same sequence but by construction sequence - * must be higher in the new one. All good in that case, if it - * isn't then this means that sequence numbers are decreasing - * or files were inserted */ - if (f1->sequence < f2->sequence) { - GST_ERROR ("Media sequences inconsistent, ignoring"); - return FALSE; - } } } |