hlsdemux2: Always check DSN if required

We don't want to consider the candidate as being before the playlist if the DSN
don't match

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2839>
This commit is contained in:
Edward Hervey 2022-07-12 10:44:51 +02:00 committed by Tim-Philipp Müller
parent 5d0b112c0c
commit 6934362817

View file

@ -1045,6 +1045,11 @@ find_segment_in_playlist (GstHLSMediaPlaylist * playlist,
for (idx = 0; idx < playlist->segments->len; idx++) { for (idx = 0; idx < playlist->segments->len; idx++) {
GstM3U8MediaSegment *cand = g_ptr_array_index (playlist->segments, idx); GstM3U8MediaSegment *cand = g_ptr_array_index (playlist->segments, idx);
/* Ignore non-matching DSN if needed */
if ((segment->discont_sequence != cand->discont_sequence)
&& playlist->has_ext_x_dsn)
continue;
if (idx == 0 && cand->sequence == segment->sequence + 1) { if (idx == 0 && cand->sequence == segment->sequence + 1) {
/* Special case for segments just before the 1st one. We add another /* Special case for segments just before the 1st one. We add another
* reference because it now also belongs to the current playlist */ * reference because it now also belongs to the current playlist */
@ -1055,9 +1060,7 @@ find_segment_in_playlist (GstHLSMediaPlaylist * playlist,
return segment; return segment;
} }
if ((segment->discont_sequence == cand->discont_sequence if (cand->sequence == segment->sequence) {
|| !playlist->has_ext_x_dsn)
&& (cand->sequence == segment->sequence)) {
return cand; return cand;
} }
} }