Note that there are some explanatory texts on larger screens.

plurals
  1. POopenSL ES Android: Irregular audio callback(s)
    primarykey
    data
    text
    <p>I'm using <code>openSL</code> ES in one of my <code>Android apps</code>. When the app is in the foreground the callbacks are pretty regular. The mic callback is called approximately every 10ms and so is the speaker callback. However, if I put my app in the background and open up a browser (or another app for that matter) I see that a "storm" of callbacks are triggered upon opening up the browser (or browsing). Is there a way to get around that? And why does it happen? Is openSL compensating for a period of time where it wasn't able to execute the callbacks? (like it's trying to catch up). </p> <p>My source code is in <code>C</code> and I'm on <code>Jelly Bean 4.3.</code></p> <p>I have tried to increase the thread priorities of <code>AudioTrack</code> and <code>AudioRecorder</code>, and it does seem to help, but I'm not sure that's the way to go.</p> <p><strong>ADDITIONAL QUESTIONS</strong></p> <p>So you're saying that even with increased thread priority you might get a burst of callbacks and that you should discard those ? </p> <p>How is that a good solution? You'll be dropping mic packet (or draining the source of the speaker packets), right? If you don't drop mic packets, the receiver of the mic packets will interpret the burst of mic packets as excessive jitter, right? </p> <p><strong>More importantly</strong>: I manually increased the thread priority of AudioTrack and AudioRecorder and changed the sched policy to round robin. It required both root access and installation of BusyBox (which comes with a command line util for changing thread priorities/sched policy). How is this done programatically from C ? I want to make sure that it IS the individual thread priority that is increased and not just the priority of my app (process).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload