diff options
author | Jean-Michel Trivi <> | 2009-03-24 18:11:07 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-24 18:11:07 -0700 |
commit | 4a5c1a7e84a250eafe0e3a12d859c45747520d55 (patch) | |
tree | eb0ff9222bd6535c82662ae84931680c6ef97ce1 /media/libmedia | |
parent | 59f026f2dd71a5d2676f0808a0c4c4d5354963bb (diff) | |
download | frameworks_base-4a5c1a7e84a250eafe0e3a12d859c45747520d55.zip frameworks_base-4a5c1a7e84a250eafe0e3a12d859c45747520d55.tar.gz frameworks_base-4a5c1a7e84a250eafe0e3a12d859c45747520d55.tar.bz2 |
Automated import from //branches/donutburger/...@140663,140663
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 7537ddf..24f7281 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -259,6 +259,7 @@ status_t AudioTrack::set( mLatency = afLatency + (1000*mFrameCount) / mSampleRate; mLoopCount = 0; mMarkerPosition = 0; + mMarkerReached = false; mNewPosition = 0; mUpdatePeriod = 0; @@ -360,6 +361,9 @@ void AudioTrack::stop() // Cancel loops (If we are in the middle of a loop, playback // would not stop until loopCount reaches 0). setLoop(0, 0, 0); + // the playback head position will reset to 0, so if a marker is set, we need + // to activate it again + mMarkerReached = false; // Force flush if a shared buffer is used otherwise audioflinger // will not stop before end of buffer is reached. if (mSharedBuffer != 0) { @@ -385,6 +389,12 @@ bool AudioTrack::stopped() const void AudioTrack::flush() { LOGV("flush"); + + // clear playback marker and periodic update counter + mMarkerPosition = 0; + mMarkerReached = false; + mUpdatePeriod = 0; + if (!mActive) { mAudioTrack->flush(); @@ -508,6 +518,7 @@ status_t AudioTrack::setMarkerPosition(uint32_t marker) if (mCbf == 0) return INVALID_OPERATION; mMarkerPosition = marker; + mMarkerReached = false; return NO_ERROR; } @@ -755,10 +766,10 @@ bool AudioTrack::processAudioBuffer(const sp<AudioTrackThread>& thread) } // Manage marker callback - if(mMarkerPosition > 0) { + if (!mMarkerReached && (mMarkerPosition > 0)) { if (mCblk->server >= mMarkerPosition) { mCbf(EVENT_MARKER, mUserData, (void *)&mMarkerPosition); - mMarkerPosition = 0; + mMarkerReached = true; } } |