diff options
author | Eric Laurent <elaurent@google.com> | 2013-11-14 08:49:40 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-11-14 08:49:40 -0800 |
commit | 561879df42b65f44b83c391d78d351e9ad4cb162 (patch) | |
tree | 919a28cf4f5c38963f82f8c1ac8c901cdcdc57e5 | |
parent | b04b25321dd323142eec7c5136c81dea3629cf14 (diff) | |
parent | 307aa87038017dff8ae1dd0262c0ff87723894d7 (diff) | |
download | frameworks_av-561879df42b65f44b83c391d78d351e9ad4cb162.zip frameworks_av-561879df42b65f44b83c391d78d351e9ad4cb162.tar.gz frameworks_av-561879df42b65f44b83c391d78d351e9ad4cb162.tar.bz2 |
am 307aa870: am 4215e616: Merge "audioflinger: fix offload track transition" into klp-dev
* commit '307aa87038017dff8ae1dd0262c0ff87723894d7':
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 b893625..e6d3a4d 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -3994,23 +3994,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) { @@ -4058,6 +4041,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; |