File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1973,11 +1973,14 @@ bool AudioFlinger::MixerThread::threadLoop()
19731973 if (LIKELY (mixerStatus == MIXER_TRACKS_READY)) {
19741974 // mix buffers...
19751975 mAudioMixer ->process ();
1976- sleepTime = 0 ;
1977- // increase sleep time progressively when application underrun condition clears
1978- if (sleepTimeShift > 0 ) {
1976+ // increase sleep time progressively when application underrun condition clears.
1977+ // Only increase sleep time if the mixer is ready for two consecutive times to avoid
1978+ // that a steady state of alternating ready/not ready conditions keeps the sleep time
1979+ // such that we would underrun the audio HAL.
1980+ if ((sleepTime == 0 ) && (sleepTimeShift > 0 )) {
19791981 sleepTimeShift--;
19801982 }
1983+ sleepTime = 0 ;
19811984 standbyTime = systemTime () + kStandbyTimeInNsecs ;
19821985 // TODO: delay standby when effects have a tail
19831986 } else {
You can’t perform that action at this time.
0 commit comments