Miscellaneous audio record fixes
Call AudioSystem::stopInput() if exitPending() after wait() returns.
Acquire lock before clearing mActiveThread.
Change-Id: Ia55e4c4b3accc65ad5479cbdc094fd919152af9f
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 0730492..ffb00e7 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -6120,9 +6120,12 @@
if (!mStandby) {
mInput->stream->common.standby(&mInput->stream->common);
}
- mActiveTrack.clear();
- mStartStopCond.broadcast();
+ {
+ Mutex::Autolock _l(mLock);
+ mActiveTrack.clear();
+ mStartStopCond.broadcast();
+ }
releaseWakeLock();
@@ -6298,7 +6301,7 @@
}
mStartStopCond.wait(mLock);
// if we have been restarted, recordTrack == mActiveTrack.get() here
- if (mActiveTrack == 0 || recordTrack != mActiveTrack.get()) {
+ if (exitPending() || mActiveTrack == 0 || recordTrack != mActiveTrack.get()) {
mLock.unlock();
AudioSystem::stopInput(mId);
mLock.lock();