From 440432612be53ab8bfaa6de74effca0474e45db7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 26 Aug 2008 15:45:36 +0000 Subject: [PATCH] gst-libs/gst/audio/gstringbuffer.c: Also allow the case where the ringbuffer was paused when we try to stop it so tha... Original commit message from CVS: * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_start), (gst_ring_buffer_stop): Also allow the case where the ringbuffer was paused when we try to stop it so that the basesrc stop function is still called. --- ChangeLog | 7 +++++++ gst-libs/gst/audio/gstringbuffer.c | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 20312f8bd1..49fce93bfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-08-26 Wim Taymans + + * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_start), + (gst_ring_buffer_stop): + Also allow the case where the ringbuffer was paused when we try to stop + it so that the basesrc stop function is still called. + 2008-08-23 Sebastian Dröge Patch by: Mike Ruprecht diff --git a/gst-libs/gst/audio/gstringbuffer.c b/gst-libs/gst/audio/gstringbuffer.c index 4649e3a20c..ccb4eeeff5 100644 --- a/gst-libs/gst/audio/gstringbuffer.c +++ b/gst-libs/gst/audio/gstringbuffer.c @@ -857,13 +857,14 @@ gst_ring_buffer_start (GstRingBuffer * buf) GST_RING_BUFFER_STATE_STOPPED, GST_RING_BUFFER_STATE_STARTED); if (!res) { + GST_DEBUG_OBJECT (buf, "was not stopped, try paused"); /* was not stopped, try from paused */ res = g_atomic_int_compare_and_exchange (&buf->state, GST_RING_BUFFER_STATE_PAUSED, GST_RING_BUFFER_STATE_STARTED); if (!res) { /* was not paused either, must be started then */ res = TRUE; - GST_DEBUG_OBJECT (buf, "was started"); + GST_DEBUG_OBJECT (buf, "was not paused, must have been started"); goto done; } resume = TRUE; @@ -1016,10 +1017,16 @@ gst_ring_buffer_stop (GstRingBuffer * buf) GST_RING_BUFFER_STATE_STARTED, GST_RING_BUFFER_STATE_STOPPED); if (!res) { - /* was not started, must be stopped then */ - GST_DEBUG_OBJECT (buf, "was not started"); - res = TRUE; - goto done; + GST_DEBUG_OBJECT (buf, "was not started, try paused"); + /* was not started, try from paused */ + res = g_atomic_int_compare_and_exchange (&buf->state, + GST_RING_BUFFER_STATE_PAUSED, GST_RING_BUFFER_STATE_STOPPED); + if (!res) { + /* was not paused either, must have been stopped then */ + res = TRUE; + GST_DEBUG_OBJECT (buf, "was not paused, must have been stopped"); + goto done; + } } /* signal any waiters */