From 2ced0a3d5dd84050214d96b2bfaa906e41e74aa4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 25 Jun 2010 17:18:34 +0200 Subject: [PATCH] ringbuffer: check for ringbuffer state first Check for the state of the ringbuffer before doing the checks of the other buffer properties, when we're not started, we don't care about those values. --- gst-libs/gst/audio/gstringbuffer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/audio/gstringbuffer.c b/gst-libs/gst/audio/gstringbuffer.c index de74bcd..3cd9033 100644 --- a/gst-libs/gst/audio/gstringbuffer.c +++ b/gst-libs/gst/audio/gstringbuffer.c @@ -1960,6 +1960,12 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment, g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); + if (buf->callback == NULL) { + /* push mode, fail when nothing is started */ + if (g_atomic_int_get (&buf->state) != GST_RING_BUFFER_STATE_STARTED) + return FALSE; + } + g_return_val_if_fail (buf->data != NULL, FALSE); g_return_val_if_fail (segment != NULL, FALSE); g_return_val_if_fail (readptr != NULL, FALSE); @@ -1967,12 +1973,6 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment, data = GST_BUFFER_DATA (buf->data); - if (buf->callback == NULL) { - /* push mode, fail when nothing is started */ - if (g_atomic_int_get (&buf->state) != GST_RING_BUFFER_STATE_STARTED) - return FALSE; - } - /* get the position of the pointer */ segdone = g_atomic_int_get (&buf->segdone); -- 2.7.4