aaudio: check for callback thread outside the lock
Calling AAudioStream_requestStop() from a callback is illegal.
But it should just return and error and not hang.
The hang can occur if AAudioStream_close() is called at the same time
from another thread.
Bug: 184370309
Test: adb shell test_disconnect_race
Change-Id: I5e0752611d4d3d3dd994a10e82a339fa39e65d42
diff --git a/services/oboeservice/AAudioServiceEndpointShared.cpp b/services/oboeservice/AAudioServiceEndpointShared.cpp
index 501e8c0..0d453cf 100644
--- a/services/oboeservice/AAudioServiceEndpointShared.cpp
+++ b/services/oboeservice/AAudioServiceEndpointShared.cpp
@@ -111,7 +111,7 @@
if (!endpoint->isConnected()) {
ALOGD("%s() call safeReleaseCloseFromCallback()", __func__);
// Release and close under a lock with no check for callback collisions.
- endpoint->getStreamInternal()->safeReleaseCloseFromCallback();
+ endpoint->getStreamInternal()->safeReleaseCloseInternal();
}
return result;