AudioFlinger: Do not process MMap effects under thread lock
Not required and do not assume it.
Test: no regression with atest CtsNativeMediaAAudioTestCases
Bug: 128615806
Change-Id: I29d77d01aad417cc6aa6f882b7bc0812775e13c6
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 49f74a2..dfba700 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -8747,9 +8747,11 @@
while (!exitPending())
{
- Mutex::Autolock _l(mLock);
Vector< sp<EffectChain> > effectChains;
+ { // under Thread lock
+ Mutex::Autolock _l(mLock);
+
if (mSignalPending) {
// A signal was raised while we were unlocked
mSignalPending = false;
@@ -8784,10 +8786,13 @@
updateMetadata_l();
lockEffectChains_l(effectChains);
+ } // release Thread lock
+
for (size_t i = 0; i < effectChains.size(); i ++) {
- effectChains[i]->process_l();
+ effectChains[i]->process_l(); // Thread is not locked, but effect chain is locked
}
- // enable changes in effect chain
+
+ // enable changes in effect chain, including moving to another thread.
unlockEffectChains(effectChains);
// Effect chains will be actually deleted here if they were removed from
// mEffectChains list during mixing or effects processing