From c8f42ab3aff09af4e3f29e285d261b498be5d8d9 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 18 Mar 2024 08:47:18 +0100 Subject: [PATCH] uridecodebin3: Handle potential double redirection errors Some elements (like qtdemux) might post a redirection error message twice. We only want to handle it once. Fixes #3390 Part-of: --- .../gst/playback/gsturidecodebin3.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c b/subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c index 6518521014..7f1263fe44 100644 --- a/subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gsturidecodebin3.c @@ -149,6 +149,9 @@ struct _GstSourceHandler /* List of GstSourcePad */ GList *sourcepads; + + /* If we saw a redirection message from this source. */ + gboolean saw_redirection; }; /* Structure wrapping everything related to a urisourcebin pad */ @@ -2167,11 +2170,15 @@ gst_uri_decode_bin3_handle_redirection (GstURIDecodeBin3 * uridecodebin, if (g_strcmp0 (current_uri, uri)) { gboolean was_instant = uridecodebin->instant_uri; - GST_DEBUG_OBJECT (uridecodebin, "Doing instant switch to '%s'", uri); - uridecodebin->instant_uri = TRUE; - /* Force instant switch */ - gst_uri_decode_bin3_set_uri (uridecodebin, uri); - uridecodebin->instant_uri = was_instant; + /* We only want to handle the redirection once */ + if (!handler->saw_redirection) { + handler->saw_redirection = TRUE; + GST_DEBUG_OBJECT (uridecodebin, "Doing instant switch to '%s'", uri); + uridecodebin->instant_uri = TRUE; + /* Force instant switch */ + gst_uri_decode_bin3_set_uri (uridecodebin, uri); + uridecodebin->instant_uri = was_instant; + } gst_message_unref (message); message = NULL; }