mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 12:41:05 +00:00
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
This commit is contained in:
parent
f05ea1e6a6
commit
bfcd0737b7
2 changed files with 4 additions and 4 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue