diff options
author | Jan Alexander Steffens (heftig) <jsteffens@make.tv> | 2017-09-15 08:42:49 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-10-19 15:47:02 +0200 |
commit | 234a8ecc503c5ee7dbf34a31c1fb6e79fa4c4aa5 (patch) | |
tree | 019ec4811ccefcc5b4e2585a817209eff0800f67 /ext/hls/m3u8.c | |
parent | a563cbbc1c6d3aa65e9f034857e1f42048553545 (diff) | |
download | gstreamer-plugins-bad-234a8ecc503c5ee7dbf34a31c1fb6e79fa4c4aa5.tar.gz |
m3u8: Simplify control flow for sequence update
Split the tail from the rest of the loop.
https://bugzilla.gnome.org/show_bug.cgi?id=788417
Diffstat (limited to 'ext/hls/m3u8.c')
-rw-r--r-- | ext/hls/m3u8.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c index cf277a776..87912bc3a 100644 --- a/ext/hls/m3u8.c +++ b/ext/hls/m3u8.c @@ -407,35 +407,32 @@ gst_m3u8_update_check_consistent_media_seqnums (GstM3U8 * self, /* No match, this means f2 is the last item in the previous playlist * and we have to start our new playlist at that sequence */ mediasequence = f2->sequence + 1; - - for (l = self->files; l; l = l->next) { - f1 = l->data; - f1->sequence = mediasequence; - mediasequence++; - } + l = self->files; } else { /* Match, check that all following ones are matching too and continue * sequence numbers from there on */ mediasequence = f2->sequence; - for (; l; l = l->next) { + for (; l && m; l = l->next, m = m->next) { f1 = l->data; - f2 = m ? m->data : NULL; + f2 = m->data; f1->sequence = mediasequence; mediasequence++; - if (f2) { - if (!g_str_equal (f1->uri, f2->uri)) { - GST_WARNING ("Inconsistent URIs after playlist update"); - } + if (!g_str_equal (f1->uri, f2->uri)) { + GST_WARNING ("Inconsistent URIs after playlist update"); } - - if (m) - m = m->next; } } + + for (; l; l = l->next) { + f1 = l->data; + + f1->sequence = mediasequence; + mediasequence++; + } } return TRUE; |