From b9effe04e3cb6a3de9751573fb546ff348b72cb2 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 1 Jun 2022 15:45:23 +0200 Subject: [PATCH] hlsdemux2: Use variant stream as support for synchronizing playlists When matching playlists, there is a possibility that rendition streams will not have been updated in time (for example because that stream started later, or playback was paused). This would cause several playback failures and seeking failures. In order to still fall back on our feet, attempt to synchronize that rendition playlist against the current variant playlist. This will attempt to match the stream time using SN/DNS/PDT/... Part-of: --- .../ext/adaptivedemux2/hls/gsthlsdemux.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c index 23ee1ae..e21264c 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c @@ -1955,10 +1955,20 @@ gst_hls_demux_stream_update_media_playlist (GstHLSDemux * demux, if (stream->playlist) { if (!gst_hls_media_playlist_sync_to_playlist (new_playlist, stream->playlist)) { - /* FIXME : We need to have a way to re-calculate sync ! */ - GST_ERROR_OBJECT (stream, - "Could not synchronize new playlist with previous one !"); - return FALSE; + /* Failure to sync is only fatal for variant streams. */ + if (stream->is_variant) { + GST_ERROR_OBJECT (stream, + "Could not synchronize new variant playlist with previous one !"); + return FALSE; + } + /* For rendition streams, we can attempt synchronization against the + * variant playlist which is constantly updated */ + if (!gst_hls_media_playlist_sync_to_playlist (new_playlist, + demux->main_stream->playlist)) { + GST_ERROR_OBJECT (stream, + "Could not do fallback synchronization of rendition stream to variant stream"); + return FALSE; + } } } -- 2.7.4