From 6beca9f055c1aed2709fdbcedb9b0f95a7aba38e Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 30 Dec 2022 08:44:35 +0100 Subject: [PATCH] urisourcebin: Fix parsebin handling The goal of !3601 was to make sure we don't end up with non-streams-aware adaptive demuxers. Since we know that parsebin is streams-aware, just remember that and handle them that way. Fixes issues with some scenarios where parsebin might add pads *before* the collection is posted on the bus Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1675 Part-of: --- .../gst/playback/gsturisourcebin.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c b/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c index 5e154033131..d3c2db39720 100644 --- a/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c +++ b/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c @@ -110,6 +110,7 @@ struct _ChildSrcPadInfo GstElement *demuxer; gboolean demuxer_handles_buffering; gboolean demuxer_streams_aware; + gboolean demuxer_is_parsebin; /* list of output slots */ GList *outputs; @@ -755,7 +756,8 @@ new_demuxer_pad_added_cb (GstElement * element, GstPad * pad, GST_URI_SOURCE_BIN_LOCK (urisrc); /* Double-check that the demuxer is streams-aware by checking if it posted a * collection */ - if (info->demuxer && !info->demuxer_streams_aware) { + if (info->demuxer && !info->demuxer_is_parsebin + && !info->demuxer_streams_aware) { GST_ELEMENT_ERROR (urisrc, CORE, MISSING_PLUGIN, (NULL), ("Adaptive demuxer is not streams-aware, check your installation")); @@ -1898,6 +1900,8 @@ setup_parsebin_for_slot (ChildSrcPadInfo * info, GstPad * originating_pad) gst_element_set_locked_state (info->demuxer, TRUE); gst_bin_add (GST_BIN_CAST (urisrc), info->demuxer); + info->demuxer_is_parsebin = TRUE; + if (info->pre_parse_queue) { if (!gst_element_link_pads (info->pre_parse_queue, "src", info->demuxer, "sink")) @@ -2639,16 +2643,16 @@ handle_message (GstBin * bin, GstMessage * msg) find_adaptive_demuxer_cspi_for_msg (urisrc, (GstElement *) GST_MESSAGE_SRC (msg)); if (info) { - GST_DEBUG_OBJECT (bin, - "Dropping stream-collection for adaptive demuxer"); info->demuxer_streams_aware = TRUE; - gst_message_unref (msg); - msg = NULL; - } else if (GST_MESSAGE_SRC (msg) != (GstObject *) urisrc->source - && !urisrc->is_adaptive) { + if (info->demuxer_is_parsebin) { + GST_DEBUG_OBJECT (bin, "Dropping stream-collection from parsebin"); + gst_message_unref (msg); + msg = NULL; + } + } else if (GST_MESSAGE_SRC (msg) != (GstObject *) urisrc->source) { GST_LOG_OBJECT (bin, "Collection %" GST_PTR_FORMAT, msg); GST_DEBUG_OBJECT (bin, - "Dropping stream-collection from non-adaptive-demuxer %" + "Dropping stream-collection from %" GST_PTR_FORMAT, GST_MESSAGE_SRC (msg)); gst_message_unref (msg); msg = NULL;