From 94c393341c12198ff4d7475c45e0cfa46177ee2d Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 2 Oct 2024 11:29:38 +0200 Subject: [PATCH] urisourcebin: Ensure all stream-start are handled In order to ensure all initial events (stream-start, caps, ..) are present on pads that we expose, those various sticky events are propagated (from parsebin to multiqueue output, from multiqueue output to exposed pads). The problem was that the "hack" in `urisourcebin` to inform downstream elements that the stream is parsed data and a collection will be present was only done in one place : a probe on the output of parsebin ... but the stream-start could potentially have already been propagated to the output pads before that. In order to fix that, we make sure any pending sticky stream-start event is updated before being propagated. Fixes #3788 Part-of: --- .../gst/playback/gsturisourcebin.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c b/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c index 90d4e03131..efe48ef8e8 100644 --- a/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c +++ b/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c @@ -1208,6 +1208,19 @@ setup_multiqueue (GstURISourceBin * urisrc, ChildSrcPadInfo * info, gst_element_sync_state_with_parent (info->multiqueue); } +static gboolean +mark_stream_start_parsed (GstPad * pad, GstEvent ** event, gpointer user_data) +{ + if (GST_EVENT_TYPE (*event) == GST_EVENT_STREAM_START) { + GstStructure *s; + *event = gst_event_make_writable (*event); + s = (GstStructure *) gst_event_get_structure (*event); + gst_structure_set (s, "urisourcebin-parsed-data", G_TYPE_BOOLEAN, TRUE, + NULL); + } + return TRUE; +} + /* Called with lock held */ static OutputSlotInfo * new_output_slot (ChildSrcPadInfo * info, GstPad * originating_pad) @@ -1247,6 +1260,13 @@ new_output_slot (ChildSrcPadInfo * info, GstPad * originating_pad) slot->queue_sinkpad = gst_element_request_pad_simple (info->multiqueue, "sink_%u"); srcpad = gst_pad_get_single_internal_link (slot->queue_sinkpad); + if (urisrc->is_adaptive || (slot->linked_info + && slot->linked_info->demuxer_is_parsebin)) { + /* This is a temporary hack to notify downstream decodebin3 to *not* + * plug in an extra parsebin */ + gst_pad_sticky_events_foreach (originating_pad, mark_stream_start_parsed, + NULL); + } gst_pad_sticky_events_foreach (originating_pad, copy_sticky_events, srcpad); slot->output_pad = create_output_pad (slot, srcpad); gst_object_unref (srcpad);