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

Commit b47f51d8 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "AudioFlinger: Do not process MMap effects under thread lock"

parents 0e8c901d 13850be2
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