Bug 1353607. P9 - change the underlying type of mCurrentPosition to TimeUnit. r=kikuo

MozReview-Commit-ID: ffquOIFlp3

--HG--
extra : rebase_source : 2f6e383a1995e91f395efb4d037e151a5a656248
extra : intermediate-source : 12403091f9cee42331e12eb13945b40d02dc842f
extra : source : 1149d57835c33231411692e74836fff37b3e74de
This commit is contained in:
JW Wang 2017-03-28 18:13:22 +08:00
Родитель 88fd9831d4
Коммит 519fb03dfd
4 изменённых файлов: 16 добавлений и 13 удалений

Просмотреть файл

@ -400,7 +400,7 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
, INIT_MIRROR(mStateMachineIsShutdown, true)
, INIT_MIRROR(mBuffered, TimeIntervals())
, INIT_MIRROR(mNextFrameStatus, MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE)
, INIT_MIRROR(mCurrentPosition, 0)
, INIT_MIRROR(mCurrentPosition, TimeUnit::Zero())
, INIT_MIRROR(mStateMachineDuration, NullableTimeUnit())
, INIT_MIRROR(mPlaybackPosition, 0)
, INIT_MIRROR(mIsAudioDataAudible, false)

Просмотреть файл

@ -570,7 +570,10 @@ protected:
// This corresponds to the "current position" in HTML5.
// We allow omx subclasses to substitute an alternative current position for
// usage with the audio offload player.
virtual int64_t CurrentPosition() { return mCurrentPosition; }
virtual int64_t CurrentPosition()
{
return mCurrentPosition.Ref().ToMicroseconds();
}
// Official duration of the media resource as observed by script.
double mDuration;
@ -762,7 +765,7 @@ protected:
Mirror<MediaDecoderOwner::NextFrameStatus> mNextFrameStatus;
// NB: Don't use mCurrentPosition directly, but rather CurrentPosition().
Mirror<int64_t> mCurrentPosition;
Mirror<media::TimeUnit> mCurrentPosition;
// Duration of the media resource according to the state machine.
Mirror<media::NullableTimeUnit> mStateMachineDuration;

Просмотреть файл

@ -2421,7 +2421,7 @@ SeekingState::SeekCompleted()
// Try to decode another frame to detect if we're at the end...
SLOG("Seek completed, mCurrentPosition=%" PRId64,
mMaster->mCurrentPosition.Ref());
mMaster->mCurrentPosition.Ref().ToMicroseconds());
if (mMaster->VideoQueue().PeekFront()) {
mMaster->mMediaSink->Redraw(Info().mVideo);
@ -2633,7 +2633,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
INIT_CANONICAL(mDuration, NullableTimeUnit()),
INIT_CANONICAL(mIsShutdown, false),
INIT_CANONICAL(mNextFrameStatus, MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE),
INIT_CANONICAL(mCurrentPosition, 0),
INIT_CANONICAL(mCurrentPosition, TimeUnit::Zero()),
INIT_CANONICAL(mPlaybackOffset, 0),
INIT_CANONICAL(mIsAudioDataAudible, false)
{
@ -2911,10 +2911,10 @@ MediaDecoderStateMachine::UpdatePlaybackPositionInternal(const TimeUnit& aTime)
MOZ_ASSERT(OnTaskQueue());
LOGV("UpdatePlaybackPositionInternal(%" PRId64 ")", aTime.ToMicroseconds());
mCurrentPosition = aTime.ToMicroseconds();
NS_ASSERTION(mCurrentPosition >= 0, "CurrentTime should be positive!");
mObservedDuration = std::max(mObservedDuration.Ref(),
TimeUnit::FromMicroseconds(mCurrentPosition.Ref()));
mCurrentPosition = aTime;
NS_ASSERTION(mCurrentPosition.Ref() >= TimeUnit::Zero(),
"CurrentTime should be positive!");
mObservedDuration = std::max(mObservedDuration.Ref(), mCurrentPosition.Ref());
}
void

Просмотреть файл

@ -451,7 +451,7 @@ protected:
media::TimeUnit GetMediaTime() const
{
MOZ_ASSERT(OnTaskQueue());
return media::TimeUnit::FromMicroseconds(mCurrentPosition.Ref());
return mCurrentPosition;
}
// Returns an upper bound on the number of microseconds of audio that is
@ -746,10 +746,10 @@ private:
// compute ready state.
Canonical<NextFrameStatus> mNextFrameStatus;
// The time of the current frame in microseconds, corresponding to the "current
// The time of the current frame, corresponding to the "current
// playback position" in HTML5. This is referenced from 0, which is the initial
// playback position.
Canonical<int64_t> mCurrentPosition;
Canonical<media::TimeUnit> mCurrentPosition;
// Current playback position in the stream in bytes.
Canonical<int64_t> mPlaybackOffset;
@ -769,7 +769,7 @@ public:
{
return &mNextFrameStatus;
}
AbstractCanonical<int64_t>* CanonicalCurrentPosition()
AbstractCanonical<media::TimeUnit>* CanonicalCurrentPosition()
{
return &mCurrentPosition;
}