diff options
author | Fabrice Bellet <fabrice@bellet.info> | 2016-04-11 11:28:09 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2016-04-11 13:20:03 +0100 |
commit | 5e861d26bb0e391e12a9e623a411485b51c30da1 (patch) | |
tree | 6446f22d419bf4efbdb7074e215d3f4b919f0a81 | |
parent | 656f549662653ca73c77d52f25cf0f28536c21bc (diff) | |
download | gstreamer-plugins-base-5e861d26bb0e391e12a9e623a411485b51c30da1.tar.gz |
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
-rw-r--r-- | gst-libs/gst/audio/gstaudiosink.c | 4 | ||||
-rw-r--r-- | gst-libs/gst/audio/gstaudiosrc.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/gst-libs/gst/audio/gstaudiosink.c b/gst-libs/gst/audio/gstaudiosink.c index ca2cedafa..a80462742 100644 --- a/gst-libs/gst/audio/gstaudiosink.c +++ b/gst-libs/gst/audio/gstaudiosink.c @@ -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"); diff --git a/gst-libs/gst/audio/gstaudiosrc.c b/gst-libs/gst/audio/gstaudiosrc.c index 888fdf2c4..efd9947a5 100644 --- a/gst-libs/gst/audio/gstaudiosrc.c +++ b/gst-libs/gst/audio/gstaudiosrc.c @@ -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"); |