summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
diff options
context:
space:
mode:
authorYamit Mehta <ymehta@codeaurora.org>2015-07-12 13:14:52 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:24:48 -0600
commit49be5fa3b72c3fe0ce80423099057e49335f0178 (patch)
tree5c1ede778622989c66cd0e7ea4490576288a13d3 /media/libmedia/AudioTrack.cpp
parente783dda74af6dcd3deb2b06ca809799eeaf443e9 (diff)
downloadframeworks_av-49be5fa3b72c3fe0ce80423099057e49335f0178.zip
frameworks_av-49be5fa3b72c3fe0ce80423099057e49335f0178.tar.gz
frameworks_av-49be5fa3b72c3fe0ce80423099057e49335f0178.tar.bz2
libmedia: avoid processing stale callback events when track recycled
when track is reused from SoundPool and started again, the previous callback events could be processed immediately after track started, the new playback will be stopped then clear the stale cblk flags when recycled track is started again to avoid triggering unexpected callback events Change-Id: Ifc6fd973c655e9c7866391e7004016a7df9a9b9c CRs-Fixed: 819973
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r--media/libmedia/AudioTrack.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 64eba73..fccc6dd 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -533,6 +533,12 @@ status_t AudioTrack::start()
// force refresh of remaining frames by processAudioBuffer() as last
// write before stop could be partial.
mRefreshRemaining = true;
+
+ // for static track, clear the old flags when start from stopped state
+ if (mSharedBuffer != 0)
+ android_atomic_and(
+ ~(CBLK_LOOP_CYCLE | CBLK_LOOP_FINAL | CBLK_BUFFER_END),
+ &mCblk->mFlags);
}
mNewPosition = mPosition + mUpdatePeriod;
int32_t flags = android_atomic_and(~CBLK_DISABLED, &mCblk->mFlags);