summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorPhil Burk <philburk@google.com>2014-12-11 16:21:43 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-12-11 16:21:43 +0000
commit65575de268f4c0d75e6c1172469001ace765fc14 (patch)
treefe1df7262459e2a7a1b86e60389cbec35a62b698 /services
parent9ae34ec4f2a78d98643cf8428cd8eafdc48e6245 (diff)
parent2592184c976ef83aa9fdad7d63bfdb408c95aa7d (diff)
downloadframeworks_av-65575de268f4c0d75e6c1172469001ace765fc14.zip
frameworks_av-65575de268f4c0d75e6c1172469001ace765fc14.tar.gz
frameworks_av-65575de268f4c0d75e6c1172469001ace765fc14.tar.bz2
am 2592184c: am 6baa8fe7: am 94a92c69: Merge "[audio][audioflinger] Consume all frames when a DirectThread is done." into lmp-mr1-dev
* commit '2592184c976ef83aa9fdad7d63bfdb408c95aa7d': [audio][audioflinger] Consume all frames when a DirectThread is done.
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/Threads.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index ce08bee..f93a2c5 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4093,9 +4093,14 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prep
bool last = l.get() == track;
// The first time a track is added we wait
- // for all its buffers to be filled before processing it
+ // for all its buffers to be filled before processing it.
+ // Allow draining the buffer in case the client
+ // app does not call stop() and relies on underrun to stop:
+ // hence the test on (track->mRetryCount > 1).
+ // If retryCount<=1 then track is about to underrun and be removed.
uint32_t minFrames;
- if ((track->sharedBuffer() == 0) && !track->isStopping_1() && !track->isPausing()) {
+ if ((track->sharedBuffer() == 0) && !track->isStopping_1() && !track->isPausing()
+ && (track->mRetryCount > 1)) {
minFrames = mNormalFrameCount;
} else {
minFrames = 1;