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

Commit 1159384b authored by jiabin's avatar jiabin Committed by Jiabin Huang
Browse files

Remove cleanUpEffectsForIo.

When closing input/output, it is not needed to unregister effects.
The effects will be automatically unregistered when the audio session id
is released. If the effects are unregistered when closing input/output
and the audio session id is not released, audio policy manager will lose
the visibility of the effects. In that case, it will fail to move the
effects to new I/O when a track with the same audio session id is
attached to a new I/O.

Bug: 145197421
Test: repo steps from the bug
Change-Id: I1bee3a3ee79692c863aa3977df62346ac9dc8946
parent 9c7e2a51
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -2787,16 +2787,6 @@ status_t AudioPolicyManager::unregisterEffect(int id)
    return mEffects.unregisterEffect(id);
}

void AudioPolicyManager::cleanUpEffectsForIo(audio_io_handle_t io)
{
    EffectDescriptorCollection effects = mEffects.getEffectsForIo(io);
    for (size_t i = 0; i < effects.size(); i++) {
        ALOGW("%s removing stale effect %s, id %d on closed IO %d",
              __func__, effects.valueAt(i)->mDesc.name, effects.keyAt(i), io);
        unregisterEffect(effects.keyAt(i));
    }
}

status_t AudioPolicyManager::setEffectEnabled(int id, bool enabled)
{
    sp<EffectDescriptor> effect = mEffects.getEffect(id);
@@ -5043,8 +5033,6 @@ void AudioPolicyManager::closeOutput(audio_io_handle_t output)
            setMsdPatch();
        }
    }

    cleanUpEffectsForIo(output);
}

void AudioPolicyManager::closeInput(audio_io_handle_t input)
@@ -5076,8 +5064,6 @@ void AudioPolicyManager::closeInput(audio_io_handle_t input)
            mInputs.activeInputsCountOnDevices(primaryInputDevices) == 0) {
        mpClientInterface->setSoundTriggerCaptureState(false);
    }

    cleanUpEffectsForIo(input);
}

SortedVector<audio_io_handle_t> AudioPolicyManager::getOutputsForDevices(
+0 −2
Original line number Diff line number Diff line
@@ -886,8 +886,6 @@ private:
                int delayMs,
                uid_t uid,
                sp<AudioPatch> *patchDescPtr);

        void cleanUpEffectsForIo(audio_io_handle_t io);
};

};