From f08bdf1c4aa5fe8f0de278f061ea8f12285c0100 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 3 Oct 2022 11:16:25 +0200 Subject: [PATCH] queue2: Hold the lock when modifying sinkresult As it's done elsewhere. Avoids a potential race of the field being modified in the meantime. Part-of: --- subprojects/gstreamer/plugins/elements/gstqueue2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subprojects/gstreamer/plugins/elements/gstqueue2.c b/subprojects/gstreamer/plugins/elements/gstqueue2.c index a7b160cf02..d50435cb8c 100644 --- a/subprojects/gstreamer/plugins/elements/gstqueue2.c +++ b/subprojects/gstreamer/plugins/elements/gstqueue2.c @@ -2675,12 +2675,14 @@ gst_queue2_handle_sink_event (GstPad * pad, GstObject * parent, /* STREAM_START and SEGMENT reset the EOS status of a * pad. Change the cached sinkpad flow result accordingly */ + GST_QUEUE2_MUTEX_LOCK (queue); if (queue->sinkresult == GST_FLOW_EOS && (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START || GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT)) queue->sinkresult = GST_FLOW_OK; + else if (queue->sinkresult != GST_FLOW_OK) + goto out_flushing; - GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->sinkresult, out_flushing); if (queue->srcresult != GST_FLOW_OK) { /* Errors in sticky event pushing are no problem and ignored here * as they will cause more meaningful errors during data flow.