From d12534d21d94d39db1176a003deed73e8cea4012 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 5 Aug 2022 10:37:23 +0200 Subject: [PATCH] decodebin3: Don't output bogus GST_MESSAGE_STREAMS_SELECTED When `is_selection_done` is called, it checks that all the requested streams are present in the active stream list ... ... except there could very well be a (about to be removed) stream from the previous selection present. Therefore filter the list of streams we add to the message by the streams which are actually requested. Fixes issues when switching between different stream types (ex: video-only to audio-only). Part-of: --- .../gst-plugins-base/gst/playback/gstdecodebin3.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c index c5543b8724..f9dab82421 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c @@ -2106,10 +2106,14 @@ is_selection_done (GstDecodebin3 * dbin) for (tmp = dbin->output_streams; tmp; tmp = tmp->next) { DecodebinOutputStream *output = (DecodebinOutputStream *) tmp->data; if (output->slot) { - GST_DEBUG_OBJECT (dbin, "Adding stream %s", - gst_stream_get_stream_id (output->slot->active_stream)); - - gst_message_streams_selected_add (msg, output->slot->active_stream); + const gchar *output_streamid = + gst_stream_get_stream_id (output->slot->active_stream); + GST_DEBUG_OBJECT (dbin, "Adding stream %s", output_streamid); + if (stream_in_list (dbin->requested_selection, output_streamid)) + gst_message_streams_selected_add (msg, output->slot->active_stream); + else + GST_WARNING_OBJECT (dbin, + "Output slot still active for old selection ?"); } else GST_WARNING_OBJECT (dbin, "No valid slot for output %p", output); }