Audio glitches on android 9 at only 20% cpu

Hey, I’m getting glitches on android 9 at only 20% cpu. The same app runs fine on an iPhone 4S…
I’m using getCpuUsage() to measure it. I’d love to profile better but the android studio profiling tools segfault my app :frowning:

I saw this:

Is it really necessary to put in that load_stabilizer?

Without code/profiling it’s really hard to guess, maybe you could profile it in your development platform (Win/macOS) and you see where it bottlenecks the most. Also are you sure you aren’t making any gui/message calls inside your audio thread instead of using proper structures to communicate them? (i.e lockfree queues, value trees, etc).

I’ve profiled on every other platform, nothing surprising came up.
There are no GUI calls, no prints, nothing.
Is that load_stabilizer code necessary?

I’d love to profile better but the android studio profiling tools segfault my app

That’s worrying. Are you by any chance able to share the app on github so I can pass this to the Android Studio team? Alternatively you can file a bug by going to Help->Submit feedback which will pre-fill the issue tracker with your host environment info.

If Android Studio isn’t working for you, you can always try systrace. I wrote an article about it here: https://medium.com/@donturner/debugging-audio-glitches-on-android-ed10782f9c64

I’m getting glitches on android 9 at only 20% cpu.

What device are you testing with? Also, are you using Oboe as the backend? There is a StabilizedCallback class inside Oboe which attempts to keep the CPU spinning inside the callback so that the governor doesn’t scale down the CPU frequency, is that what you’re referring to?

1 Like