summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-11-12 19:10:17 -0800
committerEric Laurent <elaurent@google.com>2013-11-12 19:10:17 -0800
commit1b9f9b134e732a48198e51f16424f330cbf03143 (patch)
treeb51c0fd76cd949c420404ce221eae0ce9fad597e /services
parent22990fe1ee3531e84dbadb7ff9ffd68d5bbe9060 (diff)
downloadframeworks_av-1b9f9b134e732a48198e51f16424f330cbf03143.zip
frameworks_av-1b9f9b134e732a48198e51f16424f330cbf03143.tar.gz
frameworks_av-1b9f9b134e732a48198e51f16424f330cbf03143.tar.bz2
audioflinger: fix offload resume after drain
When pausing and resuming during the drain, the drain sequence number shuold not be modified otherwise the drain callback will be ignored. This causes failure to notify end of stream to audio player and transition to next song. Bug: 11247103. Change-Id: I2a35c5cc3fd6aa667cdd257f9e9cc8715cef5159
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/Threads.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index ba8195e..b8c1632 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4066,14 +4066,18 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr
track->mState = TrackBase::STOPPING_2; // so presentation completes after drain
// do not drain if no data was ever sent to HAL (mStandby == true)
if (last && !mStandby) {
- sleepTime = 0;
- standbyTime = systemTime() + standbyDelay;
- mixerStatus = MIXER_DRAIN_TRACK;
- mDrainSequence += 2;
+ // do not modify drain sequence if we are already draining. This happens
+ // when resuming from pause after drain.
+ if ((mDrainSequence & 1) == 0) {
+ sleepTime = 0;
+ standbyTime = systemTime() + standbyDelay;
+ mixerStatus = MIXER_DRAIN_TRACK;
+ mDrainSequence += 2;
+ }
if (mHwPaused) {
// It is possible to move from PAUSED to STOPPING_1 without
// a resume so we must ensure hardware is running
- mOutput->stream->resume(mOutput->stream);
+ doHwResume = true;
mHwPaused = false;
}
}