Loading include/media/AudioRecord.h +1 −0 Original line number Diff line number Diff line Loading @@ -335,6 +335,7 @@ private: uint32_t mNotificationFrames; uint32_t mRemainingFrames; uint32_t mMarkerPosition; bool mMarkerReached; uint32_t mNewPosition; uint32_t mUpdatePeriod; }; Loading include/media/AudioTrack.h +1 −0 Original line number Diff line number Diff line Loading @@ -409,6 +409,7 @@ private: int mLoopCount; uint32_t mRemainingFrames; uint32_t mMarkerPosition; bool mMarkerReached; uint32_t mNewPosition; uint32_t mUpdatePeriod; }; Loading include/media/mediaplayer.h +1 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,7 @@ private: }; sp<IMediaPlayer> mPlayer; thread_id_t mLockThreadId; Mutex mLock; Mutex mNotifyLock; Condition mSignal; Loading media/libmedia/AudioRecord.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -200,6 +200,7 @@ status_t AudioRecord::set( // TODO: add audio hardware input latency here mLatency = (1000*mFrameCount) / mSampleRate; mMarkerPosition = 0; mMarkerReached = false; mNewPosition = 0; mUpdatePeriod = 0; Loading Loading @@ -293,6 +294,9 @@ status_t AudioRecord::stop() if (android_atomic_and(~1, &mActive) == 1) { mAudioRecord->stop(); // the record head position will reset to 0, so if a marker is set, we need // to activate it again mMarkerReached = false; if (t != 0) { t->requestExit(); } else { Loading @@ -317,6 +321,7 @@ status_t AudioRecord::setMarkerPosition(uint32_t marker) if (mCbf == 0) return INVALID_OPERATION; mMarkerPosition = marker; mMarkerReached = false; return NO_ERROR; } Loading Loading @@ -492,10 +497,10 @@ bool AudioRecord::processAudioBuffer(const sp<ClientRecordThread>& thread) size_t readSize; // Manage marker callback if (mMarkerPosition > 0) { if (!mMarkerReached && (mMarkerPosition > 0)) { if (mCblk->user >= mMarkerPosition) { mCbf(EVENT_MARKER, mUserData, (void *)&mMarkerPosition); mMarkerPosition = 0; mMarkerReached = true; } } Loading media/libmedia/AudioTrack.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -259,6 +259,7 @@ status_t AudioTrack::set( mLatency = afLatency + (1000*mFrameCount) / mSampleRate; mLoopCount = 0; mMarkerPosition = 0; mMarkerReached = false; mNewPosition = 0; mUpdatePeriod = 0; Loading Loading @@ -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) { Loading @@ -386,6 +390,12 @@ void AudioTrack::flush() { LOGV("flush"); // clear playback marker and periodic update counter mMarkerPosition = 0; mMarkerReached = false; mUpdatePeriod = 0; if (!mActive) { mAudioTrack->flush(); // Release AudioTrack callback thread in case it was waiting for new buffers Loading Loading @@ -508,6 +518,7 @@ status_t AudioTrack::setMarkerPosition(uint32_t marker) if (mCbf == 0) return INVALID_OPERATION; mMarkerPosition = marker; mMarkerReached = false; return NO_ERROR; } Loading Loading @@ -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; } } Loading Loading
include/media/AudioRecord.h +1 −0 Original line number Diff line number Diff line Loading @@ -335,6 +335,7 @@ private: uint32_t mNotificationFrames; uint32_t mRemainingFrames; uint32_t mMarkerPosition; bool mMarkerReached; uint32_t mNewPosition; uint32_t mUpdatePeriod; }; Loading
include/media/AudioTrack.h +1 −0 Original line number Diff line number Diff line Loading @@ -409,6 +409,7 @@ private: int mLoopCount; uint32_t mRemainingFrames; uint32_t mMarkerPosition; bool mMarkerReached; uint32_t mNewPosition; uint32_t mUpdatePeriod; }; Loading
include/media/mediaplayer.h +1 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,7 @@ private: }; sp<IMediaPlayer> mPlayer; thread_id_t mLockThreadId; Mutex mLock; Mutex mNotifyLock; Condition mSignal; Loading
media/libmedia/AudioRecord.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -200,6 +200,7 @@ status_t AudioRecord::set( // TODO: add audio hardware input latency here mLatency = (1000*mFrameCount) / mSampleRate; mMarkerPosition = 0; mMarkerReached = false; mNewPosition = 0; mUpdatePeriod = 0; Loading Loading @@ -293,6 +294,9 @@ status_t AudioRecord::stop() if (android_atomic_and(~1, &mActive) == 1) { mAudioRecord->stop(); // the record head position will reset to 0, so if a marker is set, we need // to activate it again mMarkerReached = false; if (t != 0) { t->requestExit(); } else { Loading @@ -317,6 +321,7 @@ status_t AudioRecord::setMarkerPosition(uint32_t marker) if (mCbf == 0) return INVALID_OPERATION; mMarkerPosition = marker; mMarkerReached = false; return NO_ERROR; } Loading Loading @@ -492,10 +497,10 @@ bool AudioRecord::processAudioBuffer(const sp<ClientRecordThread>& thread) size_t readSize; // Manage marker callback if (mMarkerPosition > 0) { if (!mMarkerReached && (mMarkerPosition > 0)) { if (mCblk->user >= mMarkerPosition) { mCbf(EVENT_MARKER, mUserData, (void *)&mMarkerPosition); mMarkerPosition = 0; mMarkerReached = true; } } Loading
media/libmedia/AudioTrack.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -259,6 +259,7 @@ status_t AudioTrack::set( mLatency = afLatency + (1000*mFrameCount) / mSampleRate; mLoopCount = 0; mMarkerPosition = 0; mMarkerReached = false; mNewPosition = 0; mUpdatePeriod = 0; Loading Loading @@ -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) { Loading @@ -386,6 +390,12 @@ void AudioTrack::flush() { LOGV("flush"); // clear playback marker and periodic update counter mMarkerPosition = 0; mMarkerReached = false; mUpdatePeriod = 0; if (!mActive) { mAudioTrack->flush(); // Release AudioTrack callback thread in case it was waiting for new buffers Loading Loading @@ -508,6 +518,7 @@ status_t AudioTrack::setMarkerPosition(uint32_t marker) if (mCbf == 0) return INVALID_OPERATION; mMarkerPosition = marker; mMarkerReached = false; return NO_ERROR; } Loading Loading @@ -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; } } Loading