aaudio: fix STOP hang by unlocking around join()
Unlock and lock around the join() because the callback
thread that we are joining may be blocked by the lock.
Check for DISCONNECTED state so the error callback is
also joined correctly.
Remove unnecessary waitForStateChange that could cause
a timeout delay on DISCONNECT.
Bug: 134963902
Test: test_stop_hang (see bug report)
Change-Id: I5080fa655da35b3221234a2bcafb6ccd71d3ca27
diff --git a/media/libaaudio/src/client/AudioStreamInternalPlay.cpp b/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
index 164ad2b..b8ef247 100644
--- a/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
+++ b/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
@@ -58,6 +58,7 @@
return result;
}
+// This must be called under mStreamLock.
aaudio_result_t AudioStreamInternalPlay::requestPause()
{
aaudio_result_t result = stopCallback();