Merge "audioflinger: Remove effect from hal before closing." am: c961cd4d0c am: 7e5965b810 am: 52148b83c5 am: 0cc7be8802 am: d4d9157853
Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1403449
Change-Id: I1ef5f4e1600eda4f5ec0c92c4c24525f7de755ce
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index 3b5d6af..eaad6ef 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -315,6 +315,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;
}
@@ -588,20 +591,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);
diff --git a/services/audioflinger/Effects.h b/services/audioflinger/Effects.h
index 4d577f7..03bdc60 100644
--- a/services/audioflinger/Effects.h
+++ b/services/audioflinger/Effects.h
@@ -144,7 +144,7 @@
status_t addHandle(EffectHandle *handle);
ssize_t disconnectHandle(EffectHandle *handle, bool unpinIfLast);
ssize_t removeHandle(EffectHandle *handle);
- virtual ssize_t removeHandle_l(EffectHandle *handle);
+ ssize_t removeHandle_l(EffectHandle *handle);
EffectHandle* controlHandle_l();
bool purgeHandles();
@@ -239,8 +239,6 @@
return mOutBuffer != 0 ? reinterpret_cast<int16_t*>(mOutBuffer->ptr()) : NULL;
}
- ssize_t removeHandle_l(EffectHandle *handle) override;
-
status_t setDevices(const AudioDeviceTypeAddrVector &devices);
status_t setInputDevice(const AudioDeviceTypeAddr &device);
status_t setVolume(uint32_t *left, uint32_t *right, bool controller);