summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Eric Laurent <elaurent@google.com> 2010-10-05 14:41:42 -0700
committer Eric Laurent <elaurent@google.com> 2010-10-05 14:41:42 -0700
commit9a30fc13f55ca55bc0409f8a9d2e77d5a803bb7c (patch)
treeda8a63db182a56c61a463a9967eb98859a2efc41
parentb9a40068b590b86904b40bf466571b140d0f94b4 (diff)
Fixed AudioFlinger not always pausing tracks
If the pause request is received before the AudioTrack buffer was completelly filled and the track ready for mixing, the pause is not executed: the track just underruns and stays in pausing state. The fix consists in considering the track ready for mixing immediately if pausing. Change-Id: Ia6cb4703fee2126e41011a6400ea8eeb3a3e5456
-rw-r--r--services/audioflinger/AudioFlinger.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 8527059fd33c..cd9b07e71b07 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1715,7 +1715,7 @@ 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());
- if (cblk->framesReady() && (track->isReady() || track->isStopped()) &&
+ if (cblk->framesReady() && track->isReady() &&
!track->isPaused() && !track->isTerminated())
{
//LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);
@@ -2231,7 +2231,7 @@ bool AudioFlinger::DirectOutputThread::threadLoop()
// The first time a track is added we wait
// for all its buffers to be filled before processing it
- if (cblk->framesReady() && (track->isReady() || track->isStopped()) &&
+ if (cblk->framesReady() && track->isReady() &&
!track->isPaused() && !track->isTerminated())
{
//LOGV("track %d u=%08x, s=%08x [OK]", track->name(), cblk->user, cblk->server);
@@ -3039,7 +3039,7 @@ getNextBuffer_exit:
}
bool AudioFlinger::PlaybackThread::Track::isReady() const {
- if (mFillingUpStatus != FS_FILLING) return true;
+ if (mFillingUpStatus != FS_FILLING || isStopped() || isPausing()) return true;
if (mCblk->framesReady() >= mCblk->frameCount ||
(mCblk->flags & CBLK_FORCEREADY_MSK)) {