Fix exception when Release Audio Input Effect
Effect is removed while user switch audio output device.
When updating output device for record thread, exception happens.
Solution is to get record thread lock before update output devices.
Holding thread lock will keep effect not being removed while
updating devices.
Bug: 174714069
Test: Audio Stress Test
Change-Id: If831b2322bb02784b0a278abd9ba14b5150ff80b
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 00fbbb0..8a1a5bd 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -8636,6 +8636,7 @@
void AudioFlinger::RecordThread::updateOutDevices(const DeviceDescriptorBaseVector& outDevices)
{
+ Mutex::Autolock _l(mLock);
mOutDevices = outDevices;
mOutDeviceTypeAddrs = deviceTypeAddrsFromDescriptors(mOutDevices);
for (size_t i = 0; i < mEffectChains.size(); i++) {