From 8ec6ef8ca4ea5020f624cad2b0beffc659fdeac0 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 4 Apr 2023 23:58:36 +1000 Subject: [PATCH] adaptivedemux: Don't parse URI unnecessarily Short-circuit parsing and recreating the playlist URI if no HLS directives are going to be applied to it. Fixes problems playing some streams (YouTube) that have unneeded escaped characters in the URI and then complain when GStreamer removes the escaping Part-of: --- .../ext/adaptivedemux2/hls/gsthlsdemux-playlist-loader.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-playlist-loader.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-playlist-loader.c index 76efef5907..91a9f9eef3 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-playlist-loader.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux-playlist-loader.c @@ -358,6 +358,10 @@ static gchar * apply_directives_to_uri (GstHLSDemuxPlaylistLoader * pl, const gchar * playlist_uri, struct PlaylistDownloadParams *dl_params) { + /* Short-circuit URI parsing if nothing will change */ + if (dl_params->flags == 0) + return g_strdup (playlist_uri); + GstUri *uri = gst_uri_from_string (playlist_uri); if (dl_params->flags & PLAYLIST_DOWNLOAD_FLAG_SKIP_V1) {