inputselector: Ensure that events are pushed first on active pad

Making it less random and fixing a race in a GES test where we have
as pipeline:

```
videotestsrc ! output-selector name=s ! input-selector name=i s. ! timecodestamper ! i.
```

which we seek, leading to the seek reaching the video testsrc
without going through the timecodestamper and generating a buffer
even before timecodestamper gets the seek which means that its internal
state is wrong compared to the datastream it gets and attaches wrong
timecode metas.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/485>
This commit is contained in:
Thibault Saunier 2020-05-14 17:13:05 -04:00 committed by GStreamer Merge Bot
parent a3562b0d2a
commit 63ccf45395

View file

@ -1543,6 +1543,20 @@ gst_input_selector_event (GstPad * pad, GstObject * parent, GstEvent * event)
/* Send upstream events to all sinkpads */
iter = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (sel));
GST_INPUT_SELECTOR_LOCK (sel);
eventpad = gst_input_selector_get_active_sinkpad (sel);
if (eventpad) {
gst_object_ref (eventpad);
GST_INPUT_SELECTOR_UNLOCK (sel);
gst_event_ref (event);
result |= gst_pad_push_event (eventpad, event);
pushed_pads = g_list_append (pushed_pads, eventpad);
gst_object_unref (eventpad);
} else {
GST_INPUT_SELECTOR_UNLOCK (sel);
}
/* This is now essentially a copy of gst_pad_event_default_dispatch
* with a different iterator */
while (!done) {