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.
This commit is contained in:
Wim Taymans 2008-08-26 15:45:36 +00:00
parent 648d060427
commit 440432612b
2 changed files with 19 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2008-08-26 Wim Taymans <wim.taymans@collabora.co.uk>
* 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 <sebastian.droege@collabora.co.uk>
Patch by: Mike Ruprecht <cmaiku at gmail dot com>

View file

@ -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 */