Forcing the initial callback to a SLAndroidSimpleBufferQueueItf

767 views Asked by At

I have a bufferqueue interface (SLAndroidSimpleBufferQueueItf) for an OpenSL audio player. I register my callback with the interface. Inside my callback I am doing a conditional wait on data to be filled in a circular buffer.

My problem is I can't figure out how to get that initial call to my callback.

I have forced it by passing hardcoded data to Enqueue right after creating the interface. This has the effect of playing my dummy data and then getting into my callback where it will wait for data on the circ buffer.

This allows everything to work well. I just don't want to have to pass this dummy data to get the callback fired the first time.

What am I missing?

1

There are 1 answers

1
spartygw On BEST ANSWER

Well after further review it seems the best solution for me is to feed the Enqueue function a buffer filled with 0's.

It gets the ball rolling, causing my callback to get called which goes into a wait on a condition, waiting for incoming data to send to the speaker.