From d9f1b3736e0e6927e513e95ba934236101ca0a82 Mon Sep 17 00:00:00 2001 From: =?utf8?q?H=C3=A5vard=20Graff?= Date: Thu, 25 Nov 2010 17:01:53 +0100 Subject: [PATCH] ringbuffer: make sure to not start if the may_start flag is FALSE Fixes #635784 --- gst-libs/gst/audio/gstringbuffer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gst-libs/gst/audio/gstringbuffer.c b/gst-libs/gst/audio/gstringbuffer.c index 2989d06..87d1ce2 100644 --- a/gst-libs/gst/audio/gstringbuffer.c +++ b/gst-libs/gst/audio/gstringbuffer.c @@ -1085,6 +1085,9 @@ gst_ring_buffer_start (GstRingBuffer * buf) if (G_UNLIKELY (!buf->acquired)) goto not_acquired; + if (G_UNLIKELY (g_atomic_int_get (&buf->abidata.ABI.may_start) == FALSE)) + goto may_not_start; + /* if stopped, set to started */ res = g_atomic_int_compare_and_exchange (&buf->state, GST_RING_BUFFER_STATE_STOPPED, GST_RING_BUFFER_STATE_STARTED); @@ -1137,6 +1140,12 @@ not_acquired: GST_OBJECT_UNLOCK (buf); return FALSE; } +may_not_start: + { + GST_DEBUG_OBJECT (buf, "we may not start"); + GST_OBJECT_UNLOCK (buf); + return FALSE; + } } static gboolean -- 2.7.4