summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-11-10 01:11:28 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-10 01:11:28 +0000
commit6977ca7d5ffdbc1610a95c74653b1fbe6a665f32 (patch)
tree3098e5f5f23f3d4fa74d41ec7e8d9f1c60a138fd /services/audioflinger
parentd9f9f24db6f55f4743ece9965d4ece5f33d1b7ed (diff)
parent12edddb3a54c49422bff90b3939b55807844dc4e (diff)
downloadframeworks_av-6977ca7d5ffdbc1610a95c74653b1fbe6a665f32.zip
frameworks_av-6977ca7d5ffdbc1610a95c74653b1fbe6a665f32.tar.gz
frameworks_av-6977ca7d5ffdbc1610a95c74653b1fbe6a665f32.tar.bz2
am db7d79e6: am 2b7f91b9: Merge "Fix regression for SoundPool playback" into ics-mr1
* commit 'db7d79e6f1e1860a9bfe4756a03c753435fd0ddf': Fix regression for SoundPool playback
Diffstat (limited to 'services/audioflinger')
-rw-r--r--services/audioflinger/AudioFlinger.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 433af4a..cb6fcc6 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2066,9 +2066,14 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
// The first time a track is added we wait
// for all its buffers to be filled before processing it
mAudioMixer->setActiveTrack(track->name());
- // make sure that we have enough frames to mix one full buffer
+ // make sure that we have enough frames to mix one full buffer.
+ // enforce this condition only once to enable draining the buffer in case the client
+ // app does not call stop() and relies on underrun to stop:
+ // hence the test on (track->mRetryCount >= kMaxTrackRetries) meaning the track was mixed
+ // during last round
uint32_t minFrames = 1;
- if (!track->isStopped() && !track->isPausing()) {
+ if (!track->isStopped() && !track->isPausing() &&
+ (track->mRetryCount >= kMaxTrackRetries)) {
if (t->sampleRate() == (int)mSampleRate) {
minFrames = mFrameCount;
} else {