any reason why AudioStream::close() would block indefinitely?
Android version(s): Android 9, Android 11 Android device(s): Samsung S9, Google Pixel 3a Oboe version: 1.6.1 App name used for testing: Koala sampler Short description On first launch, my app opens an output stream only when the app starts, and then asks for permissions for the mic. It attempts to stop and close the output stream before opening a new one alongside an input stream.
Unfortunately, when closing that initial output stream, my app just hangs on close(). This is in openSL mode. Just wondered if you had any idea why a call to close() could never return? Some sort of deadlock? I've been banging my head against this for 2 days now, any hints massively appreciated.
I am not aware of any hangs or deadlocks in the OpenSL code. Are you taking any locks in your output callbacks?
Does the hang happen before you try to open the input stream?
Does it hang every time?
If you can take a bugreport, look at the tombstones or ANR section. You may find two threads fighting for the same lock, or a cross lock where mutexes are taken in the wrong order.
https://developer.android.com/studio/debug/bug-report
https://source.android.com/setup/contribute/read-bug-reports#deadlocks
I see that in logs too. When closing audio device it hangs here. Hard to reproduce, I can't on my device. We have VOIP app and I see in logs that closing player (output) stream hangs here. Maybe related to this issue? Using 1.5.0 version
@mazbox - we often receive reports of hangs or ANRs such as this. But it is very hard to analyze it properly without a bug report. If you can reproduce the issue then PLEASE capture a bugreport and send it to us through the Android bug reporting system.
https://source.android.com/setup/contribute/report-bugs File it against the framework. https://issuetracker.google.com/issues/new?component=192705
It may be related to audioserver crashes. See this link: https://github.com/google/oboe/issues/1474#issuecomment-1036688547
This might be an ANR due to an audioserver crash. See example of background operation in https://github.com/google/oboe/pull/1669
Please try using a background thread to call Oboe.