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

Commit b9d06642 authored by Eric Laurent's avatar Eric Laurent
Browse files

audioflinger: avoid cross deadlock with when releasing effect

There is a possible cross deadlock between EffectModule mutexes in
AudioFlinger and AudioPolicyService mutex when destroying an
EffectHandle in audio flinger.

This change reduces this likelyhood of this happening but does not
fix the root cause.

Bug: 180941720
Test: make.
Change-Id: Ib2cd04869143c9146accee468cc5d40f65c373b9
parent c5ee316a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -261,6 +261,12 @@ status_t AudioFlinger::EffectBase::updatePolicyState()
        }
        registered = mPolicyRegistered;
        enabled = mPolicyEnabled;
        // The simultaneous release of two EffectHandles with the same EffectModule
        // may cause us to call this method at the same time.
        // This may deadlock under some circumstances (b/180941720).  Avoid this.
        if (!doRegister && !(registered && doEnable)) {
            return NO_ERROR;
        }
        mPolicyLock.lock();
    }
    ALOGV("%s name %s id %d session %d doRegister %d registered %d doEnable %d enabled %d",