Commit 5347403a authored by Fabrice Bellet's avatar Fabrice Bellet Committed by Tim-Philipp Müller

audio: Fix a race with the audioringbuffer thread

There is a small window of time where the audio ringbuffer thread
can access the parent thread variable, before it's initialized
by the parent thread. The patch replaces this variable use by
g_thread_self().

https://bugzilla.gnome.org/show_bug.cgi?id=764865
parent da190660
......@@ -232,7 +232,7 @@ audioringbuffer_thread_func (GstAudioRingBuffer * buf)
message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
GST_STREAM_STATUS_TYPE_ENTER, GST_ELEMENT_CAST (sink));
g_value_init (&val, GST_TYPE_G_THREAD);
g_value_set_boxed (&val, sink->thread);
g_value_set_boxed (&val, g_thread_self ());
gst_message_set_stream_status_object (message, &val);
g_value_unset (&val);
GST_DEBUG_OBJECT (sink, "posting ENTER stream status");
......@@ -307,7 +307,7 @@ stop_running:
message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
GST_STREAM_STATUS_TYPE_LEAVE, GST_ELEMENT_CAST (sink));
g_value_init (&val, GST_TYPE_G_THREAD);
g_value_set_boxed (&val, sink->thread);
g_value_set_boxed (&val, g_thread_self ());
gst_message_set_stream_status_object (message, &val);
g_value_unset (&val);
GST_DEBUG_OBJECT (sink, "posting LEAVE stream status");
......
......@@ -218,7 +218,7 @@ audioringbuffer_thread_func (GstAudioRingBuffer * buf)
message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
GST_STREAM_STATUS_TYPE_ENTER, GST_ELEMENT_CAST (src));
g_value_init (&val, GST_TYPE_G_THREAD);
g_value_set_boxed (&val, src->thread);
g_value_set_boxed (&val, g_thread_self ());
gst_message_set_stream_status_object (message, &val);
g_value_unset (&val);
GST_DEBUG_OBJECT (src, "posting ENTER stream status");
......@@ -291,7 +291,7 @@ stop_running:
message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
GST_STREAM_STATUS_TYPE_LEAVE, GST_ELEMENT_CAST (src));
g_value_init (&val, GST_TYPE_G_THREAD);
g_value_set_boxed (&val, src->thread);
g_value_set_boxed (&val, g_thread_self ());
gst_message_set_stream_status_object (message, &val);
g_value_unset (&val);
GST_DEBUG_OBJECT (src, "posting LEAVE stream status");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment