audioflinger: fix record thread exit pending check
RecordThread loop must not release the mutex after checking for
exitPending and before waiting for a new wake up condition.
This can happen under the hood when methods like processConfigEvents_l()
or checkForNewParameters_l() are called. So exitPending() must
be checked after calling these functions.
Bug: 12787961.
Change-Id: Ia18c518bd5344fbb2401067303fcfe76a86879c4
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 2b37761..515368c 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4474,13 +4474,17 @@
{ // scope for mLock
Mutex::Autolock _l(mLock);
- if (exitPending()) {
- break;
- }
+
processConfigEvents_l();
// return value 'reconfig' is currently unused
bool reconfig = checkForNewParameters_l();
+ // check exitPending here because checkForNewParameters_l() and
+ // checkForNewParameters_l() can temporarily release mLock
+ if (exitPending()) {
+ break;
+ }
+
// if no active track(s), then standby and release wakelock
size_t size = mActiveTracks.size();
if (size == 0) {