audioflinger: Remove effect from hal before closing.
- For non pinned effects, when the handle is removed the effect interface
is closed, but this leads to not resetting the state of hal effects.
Don't close the interface from here, as it will be handled in
subsequent removeEffect_l.
- Clean up code related to removeHandle_l.
CRs-Fixed: 2746289
Bug: 163285058
Test: Solo tester with effects
Change-Id: I2a9b35f5f73e535afd4fe77823b9a8ba16271685
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index ca8fd2d..e972abc 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -291,6 +291,9 @@
}
}
+ // Prevent calls to process() and other functions on effect interface from now on.
+ // The effect engine will be released by the destructor when the last strong reference on
+ // this object is released which can happen after next process is called.
if (mHandles.size() == 0 && !mPinned) {
mState = DESTROYED;
}
@@ -564,20 +567,6 @@
}
-ssize_t AudioFlinger::EffectModule::removeHandle_l(EffectHandle *handle)
-{
- ssize_t status = EffectBase::removeHandle_l(handle);
-
- // Prevent calls to process() and other functions on effect interface from now on.
- // The effect engine will be released by the destructor when the last strong reference on
- // this object is released which can happen after next process is called.
- if (status == 0 && !mPinned) {
- mEffectInterface->close();
- }
-
- return status;
-}
-
bool AudioFlinger::EffectModule::updateState() {
Mutex::Autolock _l(mLock);