Loading services/audioflinger/Threads.cpp +19 −8 Original line number Diff line number Diff line Loading @@ -6014,14 +6014,6 @@ reacquire_wakelock: for (;;) { Vector< sp<EffectChain> > effectChains; // sleep with mutex unlocked if (sleepUs > 0) { ATRACE_BEGIN("sleep"); usleep(sleepUs); ATRACE_END(); sleepUs = 0; } // activeTracks accumulates a copy of a subset of mActiveTracks Vector< sp<RecordTrack> > activeTracks; Loading @@ -6042,6 +6034,15 @@ reacquire_wakelock: break; } // sleep with mutex unlocked if (sleepUs > 0) { ATRACE_BEGIN("sleep"); mWaitWorkCV.waitRelative(mLock, microseconds((nsecs_t)sleepUs)); ATRACE_END(); sleepUs = 0; continue; } // if no active track(s), then standby and release wakelock size_t size = mActiveTracks.size(); if (size == 0) { Loading @@ -6065,6 +6066,7 @@ reacquire_wakelock: } bool doBroadcast = false; bool allStopped = true; for (size_t i = 0; i < size; ) { activeTrack = mActiveTracks[i]; Loading Loading @@ -6093,15 +6095,18 @@ reacquire_wakelock: case TrackBase::STARTING_1: sleepUs = 10000; i++; allStopped = false; continue; case TrackBase::STARTING_2: doBroadcast = true; mStandby = false; activeTrack->mState = TrackBase::ACTIVE; allStopped = false; break; case TrackBase::ACTIVE: allStopped = false; break; case TrackBase::IDLE: Loading @@ -6121,6 +6126,10 @@ reacquire_wakelock: fastTrack = activeTrack; } } if (allStopped) { standbyIfNotAlreadyInStandby(); } if (doBroadcast) { mStartStopCond.broadcast(); } Loading Loading @@ -6703,6 +6712,8 @@ bool AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) { } // note that threadLoop may still be processing the track at this point [without lock] recordTrack->mState = TrackBase::PAUSING; // signal thread to stop mWaitWorkCV.broadcast(); // do not wait for mStartStopCond if exiting if (exitPending()) { return true; Loading Loading
services/audioflinger/Threads.cpp +19 −8 Original line number Diff line number Diff line Loading @@ -6014,14 +6014,6 @@ reacquire_wakelock: for (;;) { Vector< sp<EffectChain> > effectChains; // sleep with mutex unlocked if (sleepUs > 0) { ATRACE_BEGIN("sleep"); usleep(sleepUs); ATRACE_END(); sleepUs = 0; } // activeTracks accumulates a copy of a subset of mActiveTracks Vector< sp<RecordTrack> > activeTracks; Loading @@ -6042,6 +6034,15 @@ reacquire_wakelock: break; } // sleep with mutex unlocked if (sleepUs > 0) { ATRACE_BEGIN("sleep"); mWaitWorkCV.waitRelative(mLock, microseconds((nsecs_t)sleepUs)); ATRACE_END(); sleepUs = 0; continue; } // if no active track(s), then standby and release wakelock size_t size = mActiveTracks.size(); if (size == 0) { Loading @@ -6065,6 +6066,7 @@ reacquire_wakelock: } bool doBroadcast = false; bool allStopped = true; for (size_t i = 0; i < size; ) { activeTrack = mActiveTracks[i]; Loading Loading @@ -6093,15 +6095,18 @@ reacquire_wakelock: case TrackBase::STARTING_1: sleepUs = 10000; i++; allStopped = false; continue; case TrackBase::STARTING_2: doBroadcast = true; mStandby = false; activeTrack->mState = TrackBase::ACTIVE; allStopped = false; break; case TrackBase::ACTIVE: allStopped = false; break; case TrackBase::IDLE: Loading @@ -6121,6 +6126,10 @@ reacquire_wakelock: fastTrack = activeTrack; } } if (allStopped) { standbyIfNotAlreadyInStandby(); } if (doBroadcast) { mStartStopCond.broadcast(); } Loading Loading @@ -6703,6 +6712,8 @@ bool AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) { } // note that threadLoop may still be processing the track at this point [without lock] recordTrack->mState = TrackBase::PAUSING; // signal thread to stop mWaitWorkCV.broadcast(); // do not wait for mStartStopCond if exiting if (exitPending()) { return true; Loading