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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
This commit is contained in:
Edward Hervey 2022-06-01 15:45:23 +02:00 committed by GStreamer Marge Bot
parent 87ab729551
commit b9effe04e3

View file

@ -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;
}
}
}