diff options
author | Eric Laurent <elaurent@google.com> | 2013-11-14 08:47:42 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-14 08:47:42 -0800 |
commit | 307aa87038017dff8ae1dd0262c0ff87723894d7 (patch) | |
tree | 3ff70fcfeca5877317c1a4cfafe9d422caaaf064 | |
parent | b50fa77b2cc7dadae1b8ebb591d42976879ac43c (diff) | |
parent | 4215e6166fca9f87a6e9e848b3dfd4ab0d25c954 (diff) | |
download | frameworks_av-307aa87038017dff8ae1dd0262c0ff87723894d7.zip frameworks_av-307aa87038017dff8ae1dd0262c0ff87723894d7.tar.gz frameworks_av-307aa87038017dff8ae1dd0262c0ff87723894d7.tar.bz2 |
am 4215e616: Merge "audioflinger: fix offload track transition" into klp-dev
* commit '4215e6166fca9f87a6e9e848b3dfd4ab0d25c954':
audioflinger: fix offload track transition
-rw-r--r-- | services/audioflinger/Threads.cpp | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index b8c1632..de408a0 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -3984,23 +3984,6 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr sp<Track> l = mLatestActiveTrack.promote(); bool last = l.get() == track; - if (mPreviousTrack != NULL) { - if (track != mPreviousTrack) { - // Flush any data still being written from last track - mBytesRemaining = 0; - if (mPausedBytesRemaining) { - // Last track was paused so we also need to flush saved - // mixbuffer state and invalidate track so that it will - // re-submit that unwritten data when it is next resumed - mPausedBytesRemaining = 0; - // Invalidate is a bit drastic - would be more efficient - // to have a flag to tell client that some of the - // previously written data was lost - mPreviousTrack->invalidate(); - } - } - } - mPreviousTrack = track; if (track->isPausing()) { track->setPaused(); if (last) { @@ -4048,6 +4031,30 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr } if (last) { + if (mPreviousTrack != NULL) { + if (track != mPreviousTrack) { + // Flush any data still being written from last track + mBytesRemaining = 0; + if (mPausedBytesRemaining) { + // Last track was paused so we also need to flush saved + // mixbuffer state and invalidate track so that it will + // re-submit that unwritten data when it is next resumed + mPausedBytesRemaining = 0; + // Invalidate is a bit drastic - would be more efficient + // to have a flag to tell client that some of the + // previously written data was lost + mPreviousTrack->invalidate(); + } + // flush data already sent to the DSP if changing audio session as audio + // comes from a different source. Also invalidate previous track to force a + // seek when resuming. + if (mPreviousTrack->sessionId() != track->sessionId()) { + mPreviousTrack->invalidate(); + mFlushPending = true; + } + } + } + mPreviousTrack = track; // reset retry count track->mRetryCount = kMaxTrackRetriesOffload; mActiveTrack = t; |