parsebin: Set stream collection on pad before exposing it

We want to ensure the stream-collection is present on the pad (as a sticky
event) before we expose the pad.

This is more reliable since it will ensure it is present before any other event
is pushed through.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7609>
This commit is contained in:
Edward Hervey 2024-10-03 17:09:13 +02:00 committed by GStreamer Marge Bot
parent cb25b1e95e
commit f130382b08

View file

@ -3715,6 +3715,14 @@ retry:
gst_pad_sticky_events_foreach (GST_PAD_CAST (parsepad), debug_sticky_event, gst_pad_sticky_events_foreach (GST_PAD_CAST (parsepad), debug_sticky_event,
parsepad); parsepad);
/* Store the stream-collection event on the pad */
if (parsepad->active_collection == NULL && fallback_collection) {
GstEvent *new_collection =
gst_event_new_stream_collection (fallback_collection);
gst_pad_store_sticky_event (GST_PAD (parsepad), new_collection);
gst_event_unref (new_collection);
}
/* 2. activate and add */ /* 2. activate and add */
parsepad->exposed = TRUE; parsepad->exposed = TRUE;
if (!gst_element_add_pad (GST_ELEMENT (parsebin), GST_PAD_CAST (parsepad))) { if (!gst_element_add_pad (GST_ELEMENT (parsebin), GST_PAD_CAST (parsepad))) {
@ -3739,13 +3747,6 @@ retry:
gst_parse_pad_unblock (parsepad); gst_parse_pad_unblock (parsepad);
GST_DEBUG_OBJECT (parsepad, "unblocked"); GST_DEBUG_OBJECT (parsepad, "unblocked");
} }
/* Send stream-collection events for any pads that don't have them,
* and post a stream-collection onto the bus */
if (parsepad->active_collection == NULL && fallback_collection) {
gst_pad_push_event (GST_PAD (parsepad),
gst_event_new_stream_collection (fallback_collection));
}
gst_object_unref (parsepad); gst_object_unref (parsepad);
} }
g_list_free (endpads); g_list_free (endpads);