GNOME Bugzilla – Bug 661738
Deadlock between threads in gstaudiosink and gstringbuffer
Last modified: 2011-10-28 12:10:43 UTC
When playing (continuously playing over and over again) audio using alsasink, the thread audioringbuffer_thread_func() in gstaudiosink.c stops at GST_AUDIORING_BUFFER_WAIT (buf) and in gstringbuffer.c in function wait_segment() (called by default_commit()) it stops at GST_RING_BUFFER_WAIT (buf). Just before GST_AUDIORING_BUFFER_WAIT (buf) the wait_segment() has already put the buffer to state PLAYING by calling gst_ring_buffer_start (buf) and we need to check this before calling GST_AUDIORING_BUFFER_WAIT (buf). Suggestion to a solution under the else-statement in audioringbuffer_thread_func(): + if (G_UNLIKELY (g_atomic_int_get (&buf->state) == + GST_RING_BUFFER_STATE_STARTED)) { + GST_OBJECT_UNLOCK (abuf); + continue; + } GST_DEBUG_OBJECT (sink, "signal wait"); GST_AUDIORING_BUFFER_SIGNAL (buf); GST_DEBUG_OBJECT (sink, "wait for action"); GST_AUDIORING_BUFFER_WAIT (buf);
Thanks, committed: commit d430eb65c5e146681a5a1ff010d41c0fe7f55d67 Author: Mersad Jelacic <mersad@axis.com> Date: Fri Oct 28 13:58:47 2011 +0200 audiosink: avoid deadlocking audioringbuffer thread ... when it goes into wait for ringbuffer starting just after such having been signalled. Fixes #661738.