blackshard83
Posts: 67
Joined: Fri Jan 10, 2014 8:31 am

audio_render time latency

Tue Mar 21, 2017 4:33 pm

Hi all,

I'm not sure if there's already an answer, I could not find any googling around.
Related to my old forum post (viewtopic.php?f=70&t=175450), I would like to know what is the latency, in milliseconds or samples, added by audio_render OMX component?

I see that there is the config option OMX_IndexConfigAudioRenderingLatency that can be queried to get the amount of samples actually queued. I'm guessing who decides the amount of samples queued. Also is there a way to control this value?

blackshard83
Posts: 67
Joined: Fri Jan 10, 2014 8:31 am

Re: audio_render time latency

Wed Mar 22, 2017 4:50 pm

Hmmm, I guess I got it wrong:

my initial thought was that I had to feed the omx component as soon as every buffer is completed, so I have a semaphore which is increased as soon as a buffer is done, catching the EmptyBufferDone callback. This is not ideal because, I realize, the buffer is emptied immediately and transferred into firmware audio_plus library, instead I assumed that the callback would be called after the buffer was effectively played.

Now, taking a look to audio.c progam in hello_pi directory, I realize that there is a usleep to wait to reach the target latency before submitting a new buffer. This approach works pretty well in my code also, but IMO calls to sleep/usleep are naive code.

Any ideas or suggestions? Is there, perhap, a straightforward callback to reach the latency target I want that does the job?

dickon
Posts: 216
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: audio_render time latency

Wed Mar 22, 2017 6:51 pm

Have you thought about using a clock? If I'm understanding your problem correctly, it would seem to be the right thing to do.

blackshard83
Posts: 67
Joined: Fri Jan 10, 2014 8:31 am

Re: audio_render time latency

Thu Mar 23, 2017 7:48 am

No, I didn't.

My basic block is a simple audio rendering driver, just a little piece of code that outputs some raw audio.
In my experience, usually you program the audio consumer part (the audio_render component, in this case) with the latency you want (in terms of buffers/samples) and then the consumer asks the data to the producer with the right timing. The timing is intrinsically "hardware" controlled: when a buffer has played, a callback is issued, so you don't need any software timer.

Apparently the audio_render latency can't be set, so unfortunately I can't exploit the timing mechanism

Return to “OpenMAX”

Who is online

Users browsing this forum: No registered users and 5 guests