diff options
author | Eric Laurent <elaurent@google.com> | 2014-03-18 19:29:19 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-03-18 19:29:19 +0000 |
commit | da677084cf68b62063815217156e7b262b493c3d (patch) | |
tree | f67833e29f8d8d63e21f99cc45a08eb6ec47aab6 | |
parent | 89a677950917263e34327c7b47f3bb7a06ab0b28 (diff) | |
parent | 2d3ca68363f723fbe269d3ce52dab4985dfc7154 (diff) | |
download | frameworks_av-da677084cf68b62063815217156e7b262b493c3d.zip frameworks_av-da677084cf68b62063815217156e7b262b493c3d.tar.gz frameworks_av-da677084cf68b62063815217156e7b262b493c3d.tar.bz2 |
Merge "audioflinger: OffloadThread fix for resume underrun"
-rw-r--r-- | services/audioflinger/Threads.cpp | 42 | ||||
-rw-r--r-- | services/audioflinger/Tracks.cpp | 6 |
2 files changed, 27 insertions, 21 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index e90ebd1..e046e03 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -4223,32 +4223,34 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr if (last) { mFlushPending = true; } - } else if (track->framesReady() && track->isReady() && + } else if (track->isResumePending()){ + track->resumeAck(); + if (last) { + if (mPausedBytesRemaining) { + // Need to continue write that was interrupted + mCurrentWriteLength = mPausedWriteLength; + mBytesRemaining = mPausedBytesRemaining; + mPausedBytesRemaining = 0; + } + if (mHwPaused) { + doHwResume = true; + mHwPaused = false; + // threadLoop_mix() will handle the case that we need to + // resume an interrupted write + } + // enable write to audio HAL + sleepTime = 0; + + // Do not handle new data in this iteration even if track->framesReady() + mixerStatus = MIXER_TRACKS_ENABLED; + } + } else if (track->framesReady() && track->isReady() && !track->isPaused() && !track->isTerminated() && !track->isStopping_2()) { ALOGVV("OffloadThread: track %d s=%08x [OK]", track->name(), cblk->mServer); if (track->mFillingUpStatus == Track::FS_FILLED) { track->mFillingUpStatus = Track::FS_ACTIVE; // make sure processVolume_l() will apply new volume even if 0 mLeftVolFloat = mRightVolFloat = -1.0; - if (track->isResumePending()) { - track->resumeAck(); - if (last) { - if (mPausedBytesRemaining) { - // Need to continue write that was interrupted - mCurrentWriteLength = mPausedWriteLength; - mBytesRemaining = mPausedBytesRemaining; - mPausedBytesRemaining = 0; - } - if (mHwPaused) { - doHwResume = true; - mHwPaused = false; - // threadLoop_mix() will handle the case that we need to - // resume an interrupted write - } - // enable write to audio HAL - sleepTime = 0; - } - } } if (last) { diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp index c5fa624..9fe459b 100644 --- a/services/audioflinger/Tracks.cpp +++ b/services/audioflinger/Tracks.cpp @@ -1020,9 +1020,13 @@ void AudioFlinger::PlaybackThread::Track::resumeAck() { if (mState == RESUMING) mState = ACTIVE; + // Other possibility of pending resume is stopping_1 state // Do not update the state from stopping as this prevents - //drain being called. + // drain being called. + if (mState == STOPPING_1) { + mResumeToStopping = false; + } } // ---------------------------------------------------------------------------- |