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

Commit 70ec5e89 authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: fix mutex in stopOutput

Commit d7fe086d introduced a problem by acquiring the AudioPolicyService
mutex in stopOutput(). stopOutput() and releaseOtuput() can be called
from audioflinger thread loop and should never acquire the main
AudioPolicyService mutex.
Removed unnecessary check on valid port Id as this check is also performed
when doStopOutput() is executed by the command thread.

Bug: 111966786
Test: verify no timeout when starting or ending a call.
Change-Id: Id09eaae7a4409dfc54c6fbb1eced1624cd7b3536
parent f344afa9
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -254,15 +254,6 @@ status_t AudioPolicyService::startOutput(audio_port_handle_t portId)

status_t AudioPolicyService::stopOutput(audio_port_handle_t portId)
{
    {
        Mutex::Autolock _l(mLock);

        const ssize_t index = mAudioPlaybackClients.indexOfKey(portId);
        if (index < 0) {
            ALOGE("%s AudioTrack client not found for portId %d", __FUNCTION__, portId);
            return INVALID_OPERATION;
        }
    }
    if (mAudioPolicyManager == NULL) {
        return NO_INIT;
    }