From 5363bdcfcb633d822b7df0f4ed49cba391b248cd Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 21 Jun 2022 13:19:32 +0200 Subject: [PATCH] gst: protect negotiated field with lock Move the lock around the negotiated field. See !1287 --- src/gst/gstpipewiresrc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 32bcf4988..7c99de0e1 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -1026,10 +1026,10 @@ gst_pipewire_src_create (GstPushSrc * psrc, GstBuffer ** buffer) pwsrc = GST_PIPEWIRE_SRC (psrc); + pw_thread_loop_lock (pwsrc->core->loop); if (!pwsrc->negotiated) goto not_negotiated; - pw_thread_loop_lock (pwsrc->core->loop); while (TRUE) { enum pw_stream_state state; @@ -1126,6 +1126,7 @@ gst_pipewire_src_create (GstPushSrc * psrc, GstBuffer ** buffer) not_negotiated: { + pw_thread_loop_unlock (pwsrc->core->loop); return GST_FLOW_NOT_NEGOTIATED; } streaming_eos: @@ -1348,7 +1349,9 @@ gst_pipewire_src_change_state (GstElement * element, GstStateChange transition) case GST_STATE_CHANGE_PLAYING_TO_PAUSED: break; case GST_STATE_CHANGE_PAUSED_TO_READY: + pw_thread_loop_lock (this->core->loop); this->negotiated = FALSE; + pw_thread_loop_unlock (this->core->loop); break; case GST_STATE_CHANGE_READY_TO_NULL: gst_pipewire_src_close (this);