diff options
author | Eric Laurent <elaurent@google.com> | 2012-06-07 17:16:09 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2012-06-07 17:16:09 -0700 |
commit | a4f7e0e9a0e92a063f1b3a08988cf46e2cf1fa94 (patch) | |
tree | 007deb0f276a01d2276a953d2a493cf4f7d11d50 /services | |
parent | e35a55fbdff5a695ee35ff43f1466a62fb75662b (diff) | |
download | frameworks_av-a4f7e0e9a0e92a063f1b3a08988cf46e2cf1fa94.zip frameworks_av-a4f7e0e9a0e92a063f1b3a08988cf46e2cf1fa94.tar.gz frameworks_av-a4f7e0e9a0e92a063f1b3a08988cf46e2cf1fa94.tar.bz2 |
audioflinger: fix duplicating thread standby
The code that waits for a track presentation to be complete
before disabling it caused a regression for duplicating threads.
Because of the way output tracks activity is managed, the number
of frames output by the duplicating thread would never
reach the target set for a track to be considered presented.
The track would not be removed from active list and the thread would
not go to standby and keep its wakelock held.
Bug 6606922.
Change-Id: I4b46b420ac4cbf79a86b6791ae6589d407b01c92
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index e7ababa..67dbfe9 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -3891,6 +3891,7 @@ void AudioFlinger::DuplicatingThread::threadLoop_mix() } sleepTime = 0; writeFrames = mNormalFrameCount; + standbyTime = systemTime() + standbyDelay; } void AudioFlinger::DuplicatingThread::threadLoop_sleepTime() @@ -3902,21 +3903,19 @@ void AudioFlinger::DuplicatingThread::threadLoop_sleepTime() sleepTime = idleSleepTime; } } else if (mBytesWritten != 0) { - // flush remaining overflow buffers in output tracks - for (size_t i = 0; i < outputTracks.size(); i++) { - if (outputTracks[i]->isActive()) { - sleepTime = 0; - writeFrames = 0; - memset(mMixBuffer, 0, mixBufferSize); - break; - } + if (mMixerStatus == MIXER_TRACKS_ENABLED) { + writeFrames = mNormalFrameCount; + memset(mMixBuffer, 0, mixBufferSize); + } else { + // flush remaining overflow buffers in output tracks + writeFrames = 0; } + sleepTime = 0; } } void AudioFlinger::DuplicatingThread::threadLoop_write() { - standbyTime = systemTime() + standbyDelay; for (size_t i = 0; i < outputTracks.size(); i++) { outputTracks[i]->write(mMixBuffer, writeFrames); } |