diff options
author | Phil Burk <philburk@google.com> | 2014-12-10 16:46:30 -0800 |
---|---|---|
committer | Phil Burk <philburk@google.com> | 2014-12-10 17:00:18 -0800 |
commit | 99adee3c3d9cde6819741a38163954808fea270a (patch) | |
tree | b877a4a43bd36864d8109a42ecdc6b337e6838d1 /services/audioflinger | |
parent | 9257000c453c1a6f6bf073ff0bf3ba7ef9baf183 (diff) | |
download | frameworks_av-99adee3c3d9cde6819741a38163954808fea270a.zip frameworks_av-99adee3c3d9cde6819741a38163954808fea270a.tar.gz frameworks_av-99adee3c3d9cde6819741a38163954808fea270a.tar.bz2 |
[audio][audioflinger] Consume all frames when a DirectThread is done.
This bug was causing movies to think there was still data left to play so they never finished.
Bug: 18360054
Change-Id: If7aee81d62b7af8532abd14579677848a06fe2b1
Signed-off-by: Phil Burk <philburk@google.com>
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/Threads.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index dab6d91..685c1c4 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -4003,9 +4003,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; |