aggregator: Resume srcpad task on stream-start only when running

Race condition without this patch:
- srcpad task is being stopped in gst_aggregator_stop_srcpad_task()
- at that moment, in pre-queue event handler, gst_pad_get_task_state()
  returned GST_TASK_PAUSED
- then in srcpad task got stopped in gst_aggregator_stop_srcpad_task()
- finally srcpad task got resumed in pre-queue event handler

To address it, checks "running" flag in pre-queue event handler.
Both pre-queue stream-start event handler and "running" flag
are protected by SRC_LOCK already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4847>
This commit is contained in:
Seungha Yang 2023-06-13 21:53:29 +09:00 committed by GStreamer Marge Bot
parent 842805d7c6
commit 513d897d6e

View file

@ -1927,7 +1927,7 @@ gst_aggregator_default_sink_event_pre_queue (GstAggregator * self,
SRC_LOCK (self);
PAD_LOCK (aggpad);
if (event_type == GST_EVENT_STREAM_START) {
if (event_type == GST_EVENT_STREAM_START && priv->running) {
GstTaskState task_state;
aggpad->priv->flow_return = GST_FLOW_OK;