From 81fd460c909f1ee399e9f8ae4a91988ca1c7c503 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 12 Apr 2024 15:53:08 +0200 Subject: [PATCH] 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: --- .../ext/adaptivedemux2/hls/gsthlsdemux-stream.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c index 75f9a0428a..c42a71ed4b 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c @@ -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); } }