AudioFlinger: Do not wait for FastMixer if in cold idle.
Test: BT outgoing call
Bug: 34335167
Bug: 35166960
Change-Id: I1da0de844560bf77b4149dc30979eebc131d009e
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 795e009..a16d1cd 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -3973,9 +3973,11 @@
FastMixerState *state = NULL;
bool didModify = false;
FastMixerStateQueue::block_t block = FastMixerStateQueue::BLOCK_UNTIL_PUSHED;
+ bool coldIdle = false;
if (mFastMixer != 0) {
sq = mFastMixer->sq();
state = sq->begin();
+ coldIdle = state->mCommand == FastMixerState::COLD_IDLE;
}
mMixerBufferValid = false; // mMixerBuffer has no valid data until appropriate tracks found.
@@ -4471,7 +4473,15 @@
}
if (sq != NULL) {
sq->end(didModify);
- sq->push(block);
+ // No need to block if the FastMixer is in COLD_IDLE as the FastThread
+ // is not active. (We BLOCK_UNTIL_ACKED when entering COLD_IDLE
+ // when bringing the output sink into standby.)
+ //
+ // We will get the latest FastMixer state when we come out of COLD_IDLE.
+ //
+ // This occurs with BT suspend when we idle the FastMixer with
+ // active tracks, which may be added or removed.
+ sq->push(coldIdle ? FastMixerStateQueue::BLOCK_NEVER : block);
}
#ifdef AUDIO_WATCHDOG
if (pauseAudioWatchdog && mAudioWatchdog != 0) {