summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2015-10-07 17:16:11 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-07 17:16:11 +0000
commitb177e8a7559f61154a0560f7396ba9eeede80579 (patch)
treeffb7b2d81ea2ee441863124268bfd559593a622f /media
parent6ef05efae51fd743319c86c29bace5ad46cc9591 (diff)
parent61be84167c1a11c8a030e00a2b79b2bc4fdf617f (diff)
downloadframeworks_av-b177e8a7559f61154a0560f7396ba9eeede80579.zip
frameworks_av-b177e8a7559f61154a0560f7396ba9eeede80579.tar.gz
frameworks_av-b177e8a7559f61154a0560f7396ba9eeede80579.tar.bz2
Merge "AudioTrack: Prevent stop() from reissuing last marker event" into mnc-dr-dev
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/AudioTrack.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 444f4d8..ab3d66a 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -523,6 +523,15 @@ status_t AudioTrack::start()
mTimestampStartupGlitchReported = false;
mRetrogradeMotionReported = false;
+ // If previousState == STATE_STOPPED, we reactivate markers (mMarkerPosition != 0)
+ // as the position is reset to 0. This is legacy behavior. This is not done
+ // in stop() to avoid a race condition where the last marker event is issued twice.
+ // Note: the if is technically unnecessary because previousState == STATE_FLUSHED
+ // is only for streaming tracks, and mMarkerReached is already set to false.
+ if (previousState == STATE_STOPPED) {
+ mMarkerReached = false;
+ }
+
// For offloaded tracks, we don't know if the hardware counters are really zero here,
// since the flush is asynchronous and stop may not fully drain.
// We save the time when the track is started to later verify whether
@@ -592,9 +601,9 @@ void AudioTrack::stop()
mProxy->interrupt();
mAudioTrack->stop();
- // the playback head position will reset to 0, so if a marker is set, we need
- // to activate it again
- mMarkerReached = false;
+
+ // Note: legacy handling - stop does not clear playback marker
+ // and periodic update counter, but flush does for streaming tracks.
if (mSharedBuffer != 0) {
// clear buffer position and loop count.