aaudio: fix crash on disconnect for shared streams
This fixes a regression caused by ag/12396646
That CL changed the way that AudioStreams are managed
using android::sp<>. Unfortunately it caused
a crash in audioserver when shared streams were disconnected.
The root cause was calling disconnectedRegisteredStreams()
from a data processing thread, which resulted
in deleting the object while the thread was using it.
The call was unnecessary so it was removed.
Bug: 161914201
Bug: 163165126
Bug: 164411271
Bug: 166877425
Test: adb logcat *:F
Test: Use OboeTester TEST DISCONNECT
Test: See b/166877425 for more details
Change-Id: I30fc7f00061a9caf5e3d9f7c8e257102c34f9d92
Merged-In: I30fc7f00061a9caf5e3d9f7c8e257102c34f9d92
diff --git a/services/oboeservice/AAudioServiceEndpointCapture.cpp b/services/oboeservice/AAudioServiceEndpointCapture.cpp
index 43ae232..220584c 100644
--- a/services/oboeservice/AAudioServiceEndpointCapture.cpp
+++ b/services/oboeservice/AAudioServiceEndpointCapture.cpp
@@ -69,7 +69,7 @@
// Read audio data from stream using a blocking read.
result = getStreamInternal()->read(mDistributionBuffer, getFramesPerBurst(), timeoutNanos);
if (result == AAUDIO_ERROR_DISCONNECTED) {
- disconnectRegisteredStreams();
+ ALOGV("%s() read() returned AAUDIO_ERROR_DISCONNECTED, break", __func__);
break;
} else if (result != getFramesPerBurst()) {
ALOGW("callbackLoop() read %d / %d",