From b2c0f490f050f43f140b878af21681a3994169c0 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 3 Oct 2024 17:16:25 +0200 Subject: [PATCH] urisourcebin: Set pad probe before linking pad We want to grab all events that pass through, so we need to set the probe **before** the pad is linked Part-of: --- .../gst-plugins-base/gst/playback/gsturisourcebin.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c b/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c index bc54a04feb..86994ecb60 100644 --- a/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c +++ b/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c @@ -884,11 +884,6 @@ new_demuxer_pad_added_cb (GstElement * element, GstPad * pad, slot = new_output_slot (info, pad); output_pad = gst_object_ref (slot->output_pad); - slot->demuxer_event_probe_id = - gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | - GST_PAD_PROBE_TYPE_EVENT_FLUSH, (GstPadProbeCallback) demux_pad_events, - slot, NULL); - GST_URI_SOURCE_BIN_UNLOCK (urisrc); expose_output_pad (urisrc, output_pad); gst_object_unref (output_pad); @@ -1275,11 +1270,18 @@ new_output_slot (ChildSrcPadInfo * info, GstPad * originating_pad) gst_pad_sticky_events_foreach (originating_pad, copy_sticky_events, ©_data); + if (info->demuxer) { + /* Make sure we add the event probe *before* linking */ + slot->demuxer_event_probe_id = + gst_pad_add_probe (originating_pad, + GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_FLUSH, + (GstPadProbeCallback) demux_pad_events, slot, NULL); } slot->output_pad = create_output_pad (slot, srcpad); gst_object_unref (srcpad); gst_pad_link (originating_pad, slot->queue_sinkpad); + GST_PAD_STREAM_UNLOCK (originating_pad); } /* If buffering is required, create the element. If downloadbuffer is * required, it will take precedence over queue2 */