mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
audioringbuffer: set waiting to 0 when signaling
Reset the waiting thread counter in all places to be consistent when sending signal for the audio ring buffer. This fix applies it to pause, stop and release, which are states that will go into a callback of the subclass. Having the waiting counter reset will avoid having executing thread of the same subclass trying to take the mutex when callong gst_audio_ring_buffer_advance. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6195>
This commit is contained in:
parent
d18d6a70ac
commit
8c5203ba0e
1 changed files with 12 additions and 6 deletions
|
@ -805,8 +805,10 @@ gst_audio_ring_buffer_release (GstAudioRingBuffer * buf)
|
|||
res = rclass->release (buf);
|
||||
|
||||
/* signal any waiters */
|
||||
GST_DEBUG_OBJECT (buf, "signal waiter");
|
||||
GST_AUDIO_RING_BUFFER_SIGNAL (buf);
|
||||
if (g_atomic_int_compare_and_exchange (&buf->waiting, 1, 0)) {
|
||||
GST_DEBUG_OBJECT (buf, "signal waiter");
|
||||
GST_AUDIO_RING_BUFFER_SIGNAL (buf);
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (!res))
|
||||
goto release_failed;
|
||||
|
@ -1145,8 +1147,10 @@ gst_audio_ring_buffer_pause_unlocked (GstAudioRingBuffer * buf)
|
|||
goto not_started;
|
||||
|
||||
/* signal any waiters */
|
||||
GST_DEBUG_OBJECT (buf, "signal waiter");
|
||||
GST_AUDIO_RING_BUFFER_SIGNAL (buf);
|
||||
if (g_atomic_int_compare_and_exchange (&buf->waiting, 1, 0)) {
|
||||
GST_DEBUG_OBJECT (buf, "signal waiter");
|
||||
GST_AUDIO_RING_BUFFER_SIGNAL (buf);
|
||||
}
|
||||
|
||||
rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf);
|
||||
if (G_LIKELY (rclass->pause))
|
||||
|
@ -1262,8 +1266,10 @@ gst_audio_ring_buffer_stop (GstAudioRingBuffer * buf)
|
|||
}
|
||||
|
||||
/* signal any waiters */
|
||||
GST_DEBUG_OBJECT (buf, "signal waiter");
|
||||
GST_AUDIO_RING_BUFFER_SIGNAL (buf);
|
||||
if (g_atomic_int_compare_and_exchange (&buf->waiting, 1, 0)) {
|
||||
GST_DEBUG_OBJECT (buf, "signal waiter");
|
||||
GST_AUDIO_RING_BUFFER_SIGNAL (buf);
|
||||
}
|
||||
|
||||
rclass = GST_AUDIO_RING_BUFFER_GET_CLASS (buf);
|
||||
if (G_LIKELY (rclass->stop))
|
||||
|
|
Loading…
Reference in a new issue