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

Commit 13850be2 authored by Andy Hung's avatar Andy Hung
Browse files

AudioFlinger: Do not process MMap effects under thread lock

Not required and do not assume it.

Test: no regression with atest CtsNativeMediaAAudioTestCases
Bug: 128615806
Change-Id: I29d77d01aad417cc6aa6f882b7bc0812775e13c6
parent 0a2fc30b
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -8747,9 +8747,11 @@ bool AudioFlinger::MmapThread::threadLoop()

    while (!exitPending())
    {
        Mutex::Autolock _l(mLock);
        Vector< sp<EffectChain> > effectChains;

        { // under Thread lock
        Mutex::Autolock _l(mLock);

        if (mSignalPending) {
            // A signal was raised while we were unlocked
            mSignalPending = false;
@@ -8784,10 +8786,13 @@ bool AudioFlinger::MmapThread::threadLoop()
        updateMetadata_l();

        lockEffectChains_l(effectChains);
        } // release Thread lock

        for (size_t i = 0; i < effectChains.size(); i ++) {
            effectChains[i]->process_l();
            effectChains[i]->process_l(); // Thread is not locked, but effect chain is locked
        }
        // enable changes in effect chain

        // enable changes in effect chain, including moving to another thread.
        unlockEffectChains(effectChains);
        // Effect chains will be actually deleted here if they were removed from
        // mEffectChains list during mixing or effects processing