Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e8396f0 authored by Phil Burk's avatar Phil Burk
Browse files

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: 164411271
Bug: 166877425
Test: adb logcat *:F
Test: Use OboeTester TEST DISCONNECT
Test: See b/166877425 for more details
Change-Id: I30fc7f00061a9caf5e3d9f7c8e257102c34f9d92
parent 244e5086
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ void *AAudioServiceEndpointCapture::callbackLoop() {
        result = getStreamInternal()->read(mDistributionBuffer.get(),
                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",
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ void *AAudioServiceEndpointPlay::callbackLoop() {
        result = getStreamInternal()->write(mMixer.getOutputBuffer(),
                                            getFramesPerBurst(), timeoutNanos);
        if (result == AAUDIO_ERROR_DISCONNECTED) {
            AAudioServiceEndpointShared::disconnectRegisteredStreams();
            ALOGV("%s() write() returned AAUDIO_ERROR_DISCONNECTED, break", __func__);
            break;
        } else if (result != getFramesPerBurst()) {
            ALOGW("callbackLoop() wrote %d / %d",