From d9a903b2930f9780aa18b9a3222ad1f2c0ee536b Mon Sep 17 00:00:00 2001 From: Themaister Date: Tue, 30 Oct 2012 00:37:00 +0100 Subject: [PATCH] Revert "Might improve audio performance in SL." This broke stuff. --- audio/opensl.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/audio/opensl.c b/audio/opensl.c index efb595b2ad..c5bd2fcb15 100644 --- a/audio/opensl.c +++ b/audio/opensl.c @@ -59,28 +59,17 @@ static void opensl_callback(SLAndroidSimpleBufferQueueItf bq, void *ctx) { sl_t *sl = (sl_t*)ctx; - for (;;) - { - slock_lock(sl->lock); - size_t read_avail = fifo_read_avail(sl->fifo); - if (read_avail > BUFFER_SIZE) - read_avail = BUFFER_SIZE; + slock_lock(sl->lock); + size_t read_avail = fifo_read_avail(sl->fifo); + if (read_avail > BUFFER_SIZE) + read_avail = BUFFER_SIZE; + fifo_read(sl->fifo, sl->buffer, read_avail); + slock_unlock(sl->lock); - if (read_avail) - { - fifo_read(sl->fifo, sl->buffer, read_avail); - slock_unlock(sl->lock); - scond_signal(sl->cond); - } - else - { - slock_unlock(sl->lock); - break; - } + memset(sl->buffer + read_avail, 0, BUFFER_SIZE - read_avail); + (*bq)->Enqueue(bq, sl->buffer, BUFFER_SIZE); - memset(sl->buffer + read_avail, 0, BUFFER_SIZE - read_avail); - (*bq)->Enqueue(bq, sl->buffer, BUFFER_SIZE); - } + scond_signal(sl->cond); } #define GOTO_IF_FAIL(x) do { \