gst-libs/gst/audio/gstringbuffer.c: In pull mode we want the callback to prepull a buffer we can preroll on even when...

Original commit message from CVS:
* gst-libs/gst/audio/gstringbuffer.c:
(gst_ring_buffer_prepare_read):
In pull mode we want the callback to prepull a buffer we can preroll on
even when we are not yet playing.
This commit is contained in:
Wim Taymans 2008-10-16 15:38:50 +00:00
parent 2cd4c7e2b9
commit 7bd29abb9d
2 changed files with 16 additions and 7 deletions

View file

@ -1,3 +1,10 @@
2008-10-16 Wim Taymans <wim.taymans@collabora.co.uk>
* gst-libs/gst/audio/gstringbuffer.c:
(gst_ring_buffer_prepare_read):
In pull mode we want the callback to prepull a buffer we can preroll on
even when we are not yet playing.
2008-10-16 Stefan Kost <ensonic@users.sf.net> 2008-10-16 Stefan Kost <ensonic@users.sf.net>
* ext/alsa/Makefile.am: * ext/alsa/Makefile.am:

View file

@ -1662,10 +1662,6 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment,
g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE); g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
/* buffer must be 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 (buf->data != NULL, FALSE);
g_return_val_if_fail (segment != NULL, FALSE); g_return_val_if_fail (segment != NULL, FALSE);
g_return_val_if_fail (readptr != NULL, FALSE); g_return_val_if_fail (readptr != NULL, FALSE);
@ -1673,6 +1669,12 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment,
data = GST_BUFFER_DATA (buf->data); 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 */ /* get the position of the pointer */
segdone = g_atomic_int_get (&buf->segdone); segdone = g_atomic_int_get (&buf->segdone);
@ -1680,14 +1682,14 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment,
*len = buf->spec.segsize; *len = buf->spec.segsize;
*readptr = data + *segment * *len; *readptr = data + *segment * *len;
GST_LOG ("prepare read from segment %d (real %d) @%p",
*segment, segdone, *readptr);
/* callback to fill the memory with data, for pull based /* callback to fill the memory with data, for pull based
* scheduling. */ * scheduling. */
if (buf->callback) if (buf->callback)
buf->callback (buf, *readptr, *len, buf->cb_data); buf->callback (buf, *readptr, *len, buf->cb_data);
GST_LOG ("prepare read from segment %d (real %d) @%p",
*segment, segdone, *readptr);
return TRUE; return TRUE;
} }