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

Commit 411e24d4 authored by David Li's avatar David Li Committed by Automerger Merge Worker
Browse files

Merge "audioflinger: avoid removing the same effect from the audio HAL twice"...

Merge "audioflinger: avoid removing the same effect from the audio HAL twice" into sc-dev am: ca26c2d9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/15065570

Change-Id: I11bed239ece9ad2e8c19f445b3ea5e30ef55a80a
parents 19c93d60 ca26c2d9
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -558,7 +558,8 @@ AudioFlinger::EffectModule::EffectModule(const sp<AudioFlinger::EffectCallbackIn
      mStatus(NO_INIT),
      mMaxDisableWaitCnt(1), // set by configure(), should be >= 1
      mDisableWaitCnt(0),    // set by process() and updateState()
      mOffloaded(false)
      mOffloaded(false),
      mAddedToHal(false)
#ifdef FLOAT_EFFECT_CHAIN
      , mSupportsFloat(false)
#endif
@@ -1080,7 +1081,12 @@ void AudioFlinger::EffectModule::addEffectToHal_l()
{
    if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC ||
         (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC) {
        if (mAddedToHal) {
            return;
        }

        (void)getCallback()->addEffectToHal(mEffectInterface);
        mAddedToHal = true;
    }
}

@@ -1176,7 +1182,12 @@ status_t AudioFlinger::EffectModule::removeEffectFromHal_l()
{
    if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC ||
             (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC) {
        if (!mAddedToHal) {
            return NO_ERROR;
        }

        getCallback()->removeEffectFromHal(mEffectInterface);
        mAddedToHal = false;
    }
    return NO_ERROR;
}
+1 −0
Original line number Diff line number Diff line
@@ -286,6 +286,7 @@ private:
                                    // sending disable command.
    uint32_t mDisableWaitCnt;       // current process() calls count during disable period.
    bool     mOffloaded;            // effect is currently offloaded to the audio DSP
    bool     mAddedToHal;           // effect has been added to the audio HAL

#ifdef FLOAT_EFFECT_CHAIN
    bool    mSupportsFloat;         // effect supports float processing