Skip to content

Rogue OpenSL ES thread consumes CPU time when application is suspended #4

@simonmorris

Description

@simonmorris

Hi there,
Many thanks for the useful library, it has worked an absolute treat for us.

I've encountered an issue with our application where I'm seeing a "rogue" thread created that continues to use CPU cycles when the application is suspended. I say rogue because it only shows up in HTOP, but not on ADM.

HTOP on android shows the suspect thread with a priority (PRI) of 4, and a nice value (NI) or -16, and on a Nexus 7 it quietly consumes between 4-9% of CPU, even though all the other threads in our suspended applications process are reporting 0% CPU usage.

I'm still investigating this issue, but right now the thread in question seems to be created a some point after alcOpenDevice and before alcCreateContext has completed. I strongly suspect it is slCreateEngine creating a worker thread.

So I'm wondering what the best practice is for handling audio when applications receive a suspend event? Currently our logic just pauses all streams/sounds and stop ticking the audio update loop. But perhaps should we be doing more to destroy/re-create the active context? Sounds like a headache though, I would prefer to dodge that.

I've looked around the net but not found any particular android guidelines for handling OpenSL ES audio when an application suspends, so any thoughts gratefully received.

Many thanks,
Simon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions