From dfe00bd0369ddf273206ccd6895b0aea4f562baf Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 7 May 2015 17:06:05 -0700 Subject: [PATCH] Bug 1162803 - Rename mCurrentFrameTime to mCurrentPosition to better match the naming in the spec. r=jww This field corresponds to the "current playback position" in HTML5. --- dom/media/MediaDecoderStateMachine.cpp | 24 ++++++++++++------------ dom/media/MediaDecoderStateMachine.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index a808c214b308..a2e075b47230 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -223,7 +223,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder, "MediaDecoderStateMachine::mNextFrameStatus (Canonical)"), mFragmentEndTime(-1), mReader(aReader), - mCurrentFrameTime(0), + mCurrentPosition(0), mAudioStartTime(-1), mAudioEndTime(-1), mDecodedAudioEndTime(-1), @@ -1305,10 +1305,10 @@ void MediaDecoderStateMachine::UpdatePlaybackPositionInternal(int64_t aTime) AssertCurrentThreadInMonitor(); NS_ASSERTION(mStartTime >= 0, "Should have positive mStartTime"); - mCurrentFrameTime = aTime - mStartTime; - NS_ASSERTION(mCurrentFrameTime >= 0, "CurrentTime should be positive!"); + mCurrentPosition = aTime - mStartTime; + NS_ASSERTION(mCurrentPosition >= 0, "CurrentTime should be positive!"); if (aTime > mEndTime) { - NS_ASSERTION(mCurrentFrameTime > GetDuration(), + NS_ASSERTION(mCurrentPosition > GetDuration(), "CurrentTime must be after duration if aTime > endTime!"); DECODER_LOG("Setting new end time to %lld", aTime); mEndTime = aTime; @@ -1391,12 +1391,12 @@ void MediaDecoderStateMachine::VolumeChanged() double MediaDecoderStateMachine::GetCurrentTime() const { - return static_cast(mCurrentFrameTime) / static_cast(USECS_PER_S); + return static_cast(mCurrentPosition) / static_cast(USECS_PER_S); } int64_t MediaDecoderStateMachine::GetCurrentTimeUs() const { - return mCurrentFrameTime; + return mCurrentPosition; } bool MediaDecoderStateMachine::IsRealTime() const @@ -1459,7 +1459,7 @@ void MediaDecoderStateMachine::SetDuration(int64_t aDuration) mEndTime = mStartTime + aDuration; - if (mDecoder && mEndTime >= 0 && mEndTime < mCurrentFrameTime) { + if (mDecoder && mEndTime >= 0 && mEndTime < mCurrentPosition) { // The current playback position is now past the end of the element duration // the user agent must also seek to the time of the end of the media // resource. @@ -1532,7 +1532,7 @@ void MediaDecoderStateMachine::SetDormant(bool aDormant) } else if (mCurrentSeek.Exists()) { mQueuedSeek.Steal(mCurrentSeek); } else { - mQueuedSeek.mTarget = SeekTarget(mCurrentFrameTime, + mQueuedSeek.mTarget = SeekTarget(mCurrentPosition, SeekTarget::Accurate, MediaDecoderEventVisibility::Suppressed); // XXXbholley - Nobody is listening to this promise. Do we need to pass it @@ -1540,7 +1540,7 @@ void MediaDecoderStateMachine::SetDormant(bool aDormant) nsRefPtr unused = mQueuedSeek.mPromise.Ensure(__func__); } } else { - mQueuedSeek.mTarget = SeekTarget(mCurrentFrameTime, + mQueuedSeek.mTarget = SeekTarget(mCurrentPosition, SeekTarget::Accurate, MediaDecoderEventVisibility::Suppressed); // XXXbholley - Nobody is listening to this promise. Do we need to pass it @@ -1570,7 +1570,7 @@ void MediaDecoderStateMachine::SetDormant(bool aDormant) } else if ((aDormant != true) && (mState == DECODER_STATE_DORMANT)) { mDecodingFrozenAtStateDecoding = true; ScheduleStateMachine(); - mCurrentFrameTime = 0; + mCurrentPosition = 0; SetState(DECODER_STATE_DECODING_NONE); mDecoder->GetReentrantMonitor().NotifyAll(); } @@ -1926,7 +1926,7 @@ MediaDecoderStateMachine::InitiateSeek() // Stop playback now to ensure that while we're outside the monitor // dispatching SeekingStarted, playback doesn't advance and mess with - // mCurrentFrameTime that we've setting to seekTime here. + // mCurrentPosition that we've setting to seekTime here. StopPlayback(); UpdatePlaybackPositionInternal(mCurrentSeek.mTarget.mTime); @@ -2498,7 +2498,7 @@ MediaDecoderStateMachine::SeekCompleted() UpdatePlaybackPositionInternal(newCurrentTime); // Try to decode another frame to detect if we're at the end... - DECODER_LOG("Seek completed, mCurrentFrameTime=%lld", mCurrentFrameTime); + DECODER_LOG("Seek completed, mCurrentPosition=%lld", mCurrentPosition); // Reset quick buffering status. This ensures that if we began the // seek while quick-buffering, we won't bypass quick buffering mode diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 133571f56d3e..3eb6ba02fa08 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -666,7 +666,7 @@ protected: // by GetCurrentTime(), which is in the range [0,duration]. int64_t GetMediaTime() const { AssertCurrentThreadInMonitor(); - return mStartTime + mCurrentFrameTime; + return mStartTime + mCurrentPosition; } // Returns an upper bound on the number of microseconds of audio that is @@ -993,7 +993,7 @@ protected: // 0 which is the initial playback position. Set by the state machine // thread, and read-only from the main thread to get the current // time value. Synchronised via decoder monitor. - int64_t mCurrentFrameTime; + int64_t mCurrentPosition; // The presentation time of the first audio frame that was played in // microseconds. We can add this to the audio stream position to determine