Temporary fix for both normal tracks & fast tracks
If there is at least one active fast track, it forces a mixer
status of ready, which messes up the logic for normal track underruns.
Change-Id: I9de2fcaef090e2c2f99682333af3d3dd618b0d6b
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 21137f2..06b0062 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1492,6 +1492,7 @@
mMasterVolume(audioFlinger->masterVolumeSW_l()),
mLastWriteTime(0), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false),
mMixerStatus(MIXER_IDLE),
+ mMixerStatusIgnoringFastTracks(MIXER_IDLE),
standbyDelay(AudioFlinger::mStandbyTimeInNsecs),
// index 0 is reserved for normal mixer's submix
mFastTrackAvailMask(((1 << FastMixerState::kMaxFastTracks) - 1) & ~1)
@@ -2442,6 +2443,7 @@
acquireWakeLock_l();
mMixerStatus = MIXER_IDLE;
+ mMixerStatusIgnoringFastTracks = MIXER_IDLE;
checkSilentMode_l();
@@ -2455,6 +2457,7 @@
}
}
+ // mMixerStatusIgnoringFastTracks is also updated internally
mMixerStatus = prepareTracks_l(&tracksToRemove);
// prevent any changes in effect chain list and in each effect chain
@@ -2845,7 +2848,7 @@
// during last round
uint32_t minFrames = 1;
if ((track->sharedBuffer() == 0) && !track->isStopped() && !track->isPausing() &&
- (mMixerStatus == MIXER_TRACKS_READY)) {
+ (mMixerStatusIgnoringFastTracks == MIXER_TRACKS_READY)) {
if (t->sampleRate() == (int)mSampleRate) {
minFrames = mNormalFrameCount;
} else {
@@ -2994,7 +2997,7 @@
// If one track is ready, set the mixer ready if:
// - the mixer was not ready during previous round OR
// - no other track is not ready
- if (mMixerStatus != MIXER_TRACKS_READY ||
+ if (mMixerStatusIgnoringFastTracks != MIXER_TRACKS_READY ||
mixerStatus != MIXER_TRACKS_ENABLED) {
mixerStatus = MIXER_TRACKS_READY;
}
@@ -3028,7 +3031,7 @@
// If one track is not ready, mark the mixer also not ready if:
// - the mixer was ready during previous round OR
// - no other track is ready
- } else if (mMixerStatus == MIXER_TRACKS_READY ||
+ } else if (mMixerStatusIgnoringFastTracks == MIXER_TRACKS_READY ||
mixerStatus != MIXER_TRACKS_READY) {
mixerStatus = MIXER_TRACKS_ENABLED;
}
@@ -3105,6 +3108,7 @@
}
// if any fast tracks, then status is ready
+ mMixerStatusIgnoringFastTracks = mixerStatus;
if (fastTracks > 0) {
mixerStatus = MIXER_TRACKS_READY;
}
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 0b73a30..f10295f 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -1072,6 +1072,8 @@
// mixer status returned by prepareTracks_l()
mixer_state mMixerStatus; // current cycle
// previous cycle when in prepareTracks_l()
+ mixer_state mMixerStatusIgnoringFastTracks;
+ // FIXME or a separate ready state per track
// FIXME move these declarations into the specific sub-class that needs them
// MIXER only