Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is SLDataLocator_AndroidSimpleBufferQueue (Android 4.3)?

What does the '2' stand for in the following :

SLDataLocator_AndroidSimpleBufferQueue loc_bq   =
{SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};

From what I've read, it is the number of buffers.

Why 2? Why not just 1 ? And if 2 is better, why not 10 then to make it even better?

Thanks

like image 798
user1884325 Avatar asked Feb 13 '23 17:02

user1884325


1 Answers

Why 2?

If you've got 2 buffers you can fill up one with new data while the other is playing. Additionaly, it just so happens that up until recently you were required to have at least 2 buffers in your buffer queue if you wanted to be able to use Android's low-latency audio path.

Why not just 1 ?

Filling up the buffer with new data becomes quite tricky if you've only got a single buffer, since you risk not being able to generate new data fast enough.

And if 2 is better, why not 10 then to make it even better?

As you increase the number of buffers you also increase the latency (the time from when you enqueue a buffer until when that buffer will be played), assuming that you keep the buffer sizes the same.

like image 70
Michael Avatar answered Feb 20 '23 12:02

Michael