summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-11-09 08:27:18 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-09 08:27:20 -0800
commit2b7f91b932be0aa9ce6fa3acda9ff439e94643fc (patch)
treeafac3893c238200498144f566f0c33198cf9a175 /services
parent09a56563cea260f12b5606837f5b01420b920170 (diff)
parent8a04fe032b2a9ab0f2905571c59b5ce6bd0e9d71 (diff)
downloadframeworks_base-2b7f91b932be0aa9ce6fa3acda9ff439e94643fc.zip
frameworks_base-2b7f91b932be0aa9ce6fa3acda9ff439e94643fc.tar.gz
frameworks_base-2b7f91b932be0aa9ce6fa3acda9ff439e94643fc.tar.bz2
Merge "Fix regression for SoundPool playback" into ics-mr1
Diffstat (limited to 'services')
-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 96e8eb9..ff262f1 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 {