hlsdemux2: Fix failure to find a replacement segment on resync

If we end up with a segment with an internal time that varies from the supposed
one, this could be for two reasons:
* We guess-timated the wrong segment to go to when advancing or switching
  variants. In that case we try to find the actual segment to go to (just before
  this change).
* There was a complete playlist change (for whatever reason) and we can't find a
  replacement. In that case we want to carry on playback from this position but
  need to remember that we moved (by setting the stream to DISCONT, and
  resetting the new mapping).

Fixes playback on several broken stream

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6961>
This commit is contained in:
Edward Hervey 2024-04-12 15:53:08 +02:00 committed by GStreamer Marge Bot
parent 12e8874f88
commit e7ab454cf5

View file

@ -627,7 +627,9 @@ gst_hlsdemux_stream_handle_internal_time (GstHLSDemuxStream * hls_stream,
GST_WARNING_OBJECT (hls_stream,
"Could not find a replacement stream, carrying on with segment");
stream->discont = TRUE;
stream->fragment.stream_time = real_stream_time;
stream->fragment.stream_time = current_stream_time;
gst_time_map_set_values (map, current_stream_time, internal_time,
hls_stream->current_segment->datetime);
}
}