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

Commit e936b383 authored by Pavan Chikkala's avatar Pavan Chikkala Committed by Ethan Chen
Browse files

frameworks/av: port fixes in LPA effects

-audio: Fix for deadlock issue during LPA playback.
-frameworks/av: Fix the LPA-AudioEffects dead lock issue CRs-Fixed: 477511
-audioflinger: Fix pops in LPA while effects are applied CRs-Fixed: 526799
-audioflinger: Fix delay in enabling effect for LPA CRs-Fixed: 525510

Change-Id: Id3702bbeb0212cbe92370416b83daf0e383d6e3c
parent 36c4b0b6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -758,11 +758,11 @@ Exit:

void AudioFlinger::deleteEffectSession()
{
    Mutex::Autolock _l(mLock);
    ALOGV("deleteSession");
    // -2 is invalid session ID
    mLPASessionId = -2;
    if (mLPAEffectChain != NULL) {
        mLPAEffectChain->lock();
        mLPAEffectChain->setLPAFlag(false);
        size_t i, numEffects = mLPAEffectChain->getNumEffects();
        for(i = 0; i < numEffects; i++) {
@@ -775,6 +775,7 @@ void AudioFlinger::deleteEffectSession()
            }
            effect->configure();
        }
        mLPAEffectChain->unlock();
        mLPAEffectChain.clear();
        mLPAEffectChain = NULL;
    }
+4 −1
Original line number Diff line number Diff line
@@ -640,9 +640,12 @@ status_t AudioFlinger::EffectModule::setEnabled_l(bool enabled)
       Send notification event to LPA Player when an effect for
       LPA output is enabled or disabled.
    */
    if (effectStateChanged && mIsForLPA) {
    sp<EffectChain> chain = mChain.promote();
    if (effectStateChanged && chain->isForLPATrack()) {
        sp<ThreadBase> thread = mThread.promote();
        unlock();//Acquire locks in certain sequence to avoid deadlock
        thread->effectConfigChanged();
        lock();
    }
    return NO_ERROR;
}
+4 −4
Original line number Diff line number Diff line
@@ -417,10 +417,8 @@ status_t AudioFlinger::ThreadBase::sendConfigEvent_l(sp<ConfigEvent>& event)
}

void AudioFlinger::ThreadBase::effectConfigChanged() {
    mAudioFlinger->mLock.lock();
    ALOGV("New effect is being added to LPA chain, Notifying LPA Direct Track");
    mAudioFlinger->audioConfigChanged(AudioSystem::EFFECT_CONFIG_CHANGED, 0, NULL);
    mAudioFlinger->mLock.unlock();
}

void AudioFlinger::ThreadBase::sendIoConfigEvent(int event, int param)
@@ -2597,10 +2595,12 @@ bool AudioFlinger::PlaybackThread::threadLoop()
            // only process effects if we're going to write
            if (sleepTime == 0 && mType != OFFLOAD) {
                for (size_t i = 0; i < effectChains.size(); i ++) {
                    if (effectChains[i] != mAudioFlinger->mLPAEffectChain) {
                        effectChains[i]->process_l();
                  }
               }
            }
        }
        // Process effect chains for offloaded thread even if no audio
        // was read from audio track: process only updates effect state
        // and thus does have to be synchronized with audio writes but may have