OSDN Git Service

Simplify code that checks for record standby
authorGlenn Kasten <gkasten@google.com>
Wed, 14 Aug 2013 20:12:11 +0000 (13:12 -0700)
committerGlenn Kasten <gkasten@google.com>
Thu, 15 Aug 2013 00:21:00 +0000 (17:21 -0700)
Take advantage of the new processConfigEvents_l()
and it's post condition that mConfigEvents is empty.

Change-Id: Icd40fb175f3e374203c9c8d2e9df2c3929bed89b

services/audioflinger/Threads.cpp

index c0e2939..c419807 100644 (file)
@@ -380,6 +380,7 @@ void AudioFlinger::ThreadBase::processConfigEvents()
     processConfigEvents_l();
 }
 
+// post condition: mConfigEvents.isEmpty()
 void AudioFlinger::ThreadBase::processConfigEvents_l()
 {
     while (!mConfigEvents.isEmpty()) {
@@ -4214,15 +4215,14 @@ bool AudioFlinger::RecordThread::threadLoop()
     //       It is only set to true while mLock held, but we don't hold mLock yet.
     //       Probably a benign race, but it would be safer to check exitPending with mLock held.
     while (!exitPending()) {
-
-        processConfigEvents();
-
         Vector< sp<EffectChain> > effectChains;
+
         { // scope for mLock
             Mutex::Autolock _l(mLock);
+            processConfigEvents_l();
             // return value 'reconfig' is currently unused
             bool reconfig = checkForNewParameters_l();
-            if (mActiveTrack == 0 && mConfigEvents.isEmpty()) {
+            if (mActiveTrack == 0) {
                 standby();
 
                 if (exitPending()) {