summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-01-24 11:51:50 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-01-24 11:51:50 -0800
commit84e19873fde204d73628ba1b5ca9e3f5778574fa (patch)
tree113fb74556ff48132400e936fa7bd77233630429 /services
parent7c5aea0a8d9b422999483f96a2566f77ff11abf2 (diff)
parent21e4b6ed00e814bffc70895847a4944d7a190020 (diff)
downloadframeworks_av-84e19873fde204d73628ba1b5ca9e3f5778574fa.zip
frameworks_av-84e19873fde204d73628ba1b5ca9e3f5778574fa.tar.gz
frameworks_av-84e19873fde204d73628ba1b5ca9e3f5778574fa.tar.bz2
am 7eeaf3f0: Merge "AudioFlinger: refine mixer sleep time logic" into ics-mr1
* commit '7eeaf3f07aa6fb10639d9f96c1367eb98c3e8839': AudioFlinger: refine mixer sleep time logic
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 697bcdf..5a46e44 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1973,11 +1973,14 @@ bool AudioFlinger::MixerThread::threadLoop()
if (LIKELY(mixerStatus == MIXER_TRACKS_READY)) {
// mix buffers...
mAudioMixer->process();
- sleepTime = 0;
- // increase sleep time progressively when application underrun condition clears
- if (sleepTimeShift > 0) {
+ // increase sleep time progressively when application underrun condition clears.
+ // Only increase sleep time if the mixer is ready for two consecutive times to avoid
+ // that a steady state of alternating ready/not ready conditions keeps the sleep time
+ // such that we would underrun the audio HAL.
+ if ((sleepTime == 0) && (sleepTimeShift > 0)) {
sleepTimeShift--;
}
+ sleepTime = 0;
standbyTime = systemTime() + kStandbyTimeInNsecs;
//TODO: delay standby when effects have a tail
} else {