audiosink: avoid deadlocking audioringbuffer thread

... when it goes into wait for ringbuffer starting just after such
having been signalled.

Fixes #661738.
This commit is contained in:
Mersad Jelacic 2011-10-28 13:58:47 +02:00 committed by Mark Nauwelaerts
parent 88491ff2e7
commit d430eb65c5

View file

@ -265,6 +265,11 @@ audioringbuffer_thread_func (GstRingBuffer * buf)
GST_OBJECT_LOCK (abuf); GST_OBJECT_LOCK (abuf);
if (!abuf->running) if (!abuf->running)
goto stop_running; goto stop_running;
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_DEBUG_OBJECT (sink, "signal wait");
GST_AUDIORING_BUFFER_SIGNAL (buf); GST_AUDIORING_BUFFER_SIGNAL (buf);
GST_DEBUG_OBJECT (sink, "wait for action"); GST_DEBUG_OBJECT (sink, "wait for action");