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 8977da1091..19157ee8a9 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.c @@ -1294,11 +1294,6 @@ download_media_playlist (GstHLSDemuxStream * stream, gchar * orig_uri, const gchar *main_uri = gst_adaptive_demux_get_manifest_ref_uri (demux); struct PlaylistDownloadParams dl_params; - /* FIXME: Set this URI when the variant is changed */ - if (stream->playlistloader) - gst_hls_demux_playlist_loader_set_playlist_uri (stream->playlistloader, - main_uri, orig_uri); - retry: memset (&dl_params, 0, sizeof (struct PlaylistDownloadParams)); @@ -1527,6 +1522,23 @@ gst_hls_demux_stream_submit_request (GstAdaptiveDemux2Stream * stream, (stream, download_req); } +void +gst_hls_demux_stream_set_playlist_uri (GstHLSDemuxStream * hls_stream, + gchar * uri) +{ + GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX2_STREAM_CAST (hls_stream)->demux; + + if (hls_stream->playlistloader == NULL) { + hls_stream->playlistloader = + gst_hls_demux_playlist_loader_new (demux, demux->download_helper, + hls_stream->llhls_enabled); + } + + const gchar *main_uri = gst_adaptive_demux_get_manifest_ref_uri (demux); + gst_hls_demux_playlist_loader_set_playlist_uri (hls_stream->playlistloader, + main_uri, uri); +} + GstFlowReturn gst_hls_demux_stream_update_media_playlist (GstHLSDemuxStream * stream, gchar ** uri, GError ** err) @@ -2114,6 +2126,9 @@ gst_hls_demux_update_rendition_stream (GstHLSDemux * hlsdemux, } hls_stream->pending_rendition = gst_hls_rendition_stream_ref (replacement_media); + + gst_hls_demux_stream_set_playlist_uri (hls_stream, replacement_media->uri); + return TRUE; } diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.h b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.h index da1ade1ccf..b54e82dd9c 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.h +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-stream.h @@ -166,6 +166,9 @@ GstFlowReturn gst_hls_demux_stream_seek (GstAdaptiveDemux2Stream * stream, gboolean forward, GstSeekFlags flags, GstClockTimeDiff ts, GstClockTimeDiff * final_ts); +void +gst_hls_demux_stream_set_playlist_uri (GstHLSDemuxStream * stream, gchar * uri); + GstFlowReturn gst_hls_demux_stream_update_media_playlist (GstHLSDemuxStream * stream, gchar ** uri, GError ** err); diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c index c400e409fc..4c3d97d3e9 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c @@ -426,6 +426,10 @@ create_main_variant_stream (GstHLSDemux * demux) stream = create_common_hls_stream (demux, "hlsstream-variant"); demux->main_stream = hlsdemux_stream = (GstHLSDemuxStream *) stream; + + gst_hls_demux_stream_set_playlist_uri (hlsdemux_stream, + demux->current_variant->uri); + hlsdemux_stream->is_variant = TRUE; hlsdemux_stream->playlist_fetched = TRUE; /* Due to HLS manifest information being so unreliable/inconsistent, we will @@ -626,6 +630,10 @@ gst_hls_demux_set_current_variant (GstHLSDemux * hlsdemux, GST_DEBUG_OBJECT (hlsdemux, "Setting variant '%s'", variant->name); hlsdemux->current_variant = gst_hls_variant_stream_ref (variant); } + + if (hlsdemux->main_stream) { + gst_hls_demux_stream_set_playlist_uri (hlsdemux->main_stream, variant->uri); + } } static gboolean @@ -684,7 +692,7 @@ gst_hls_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf) if (variant) { GST_INFO_OBJECT (hlsdemux, "Manifest processed, initial variant selected : `%s`", variant->name); - gst_hls_demux_set_current_variant (hlsdemux, variant); // FIXME: inline? + gst_hls_demux_set_current_variant (hlsdemux, variant); } GST_DEBUG_OBJECT (hlsdemux, "Manifest handled, now setting up streams");