openslesringbuffer: Only pre-roll a single buffer

There is no reason to pre-roll more buffers here as we have our own ringbuffer
with more segments around it, and we can immediately provide more buffers to
OpenSL ES when it requests that from the callback.

Pre-rolling a single buffer before starting is necessary though, as otherwise
we will only output silence.

Lowers latency a bit, depending on latency-time and buffer-time settings.
This commit is contained in:
Sebastian Dröge 2015-02-05 12:24:04 +01:00
parent 141fb455e8
commit 83e5fe2f70

View file

@ -520,7 +520,6 @@ _opensles_player_start (GstAudioRingBuffer * rb)
{
GstOpenSLESRingBuffer *thiz = GST_OPENSLES_RING_BUFFER_CAST (rb);
SLresult result;
gint i;
/* Register callback on the buffer queue */
if (!thiz->is_queue_callback_registered) {
@ -534,11 +533,9 @@ _opensles_player_start (GstAudioRingBuffer * rb)
thiz->is_queue_callback_registered = TRUE;
}
/* Fill the queue by enqueing buffers */
/* Fill the queue by enqueing a buffer */
if (!g_atomic_int_get (&thiz->is_prerolled)) {
for (i = 0; i < thiz->data_segtotal; i++) {
_opensles_player_cb (NULL, rb);
}
_opensles_player_cb (NULL, rb);
g_atomic_int_set (&thiz->is_prerolled, 1);
}