Bug 1324339. Part 1 - merge CreateSeekTask() and ResetMDSM() with DoSeek(). r=kaku

MozReview-Commit-ID: ABJR3WaRqt5

--HG--
extra : rebase_source : e607a661477c2290440b5526e575d6f9df0bf98d
extra : intermediate-source : 4999a6b22bc99264a54d14cad6255ca9d1a906c9
extra : source : 0064958ec8dab10df1c9cbe8ec3882394e42aadf
This commit is contained in:
JW Wang 2016-12-19 13:13:32 +08:00
Родитель 788b1dfa40
Коммит 3546ba24fe
1 изменённых файлов: 4 добавлений и 27 удалений

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

@ -772,8 +772,6 @@ public:
Reader()->SetVideoBlankDecode(false);
}
CreateSeekTask();
// Don't stop playback for a video-only seek since audio is playing.
if (!mSeekJob.mTarget->IsVideoOnly()) {
mMaster->StopPlayback();
@ -788,8 +786,6 @@ public:
mMaster->UpdateNextFrameStatus(MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING);
}
ResetMDSM();
DoSeek();
return mSeekJob.mPromise.Ensure(__func__);
@ -831,10 +827,6 @@ protected:
void SeekCompleted();
private:
virtual void CreateSeekTask() = 0;
virtual void ResetMDSM() = 0;
virtual void DoSeek() = 0;
virtual int64_t CalculateNewCurrentTime() const = 0;
@ -852,6 +844,7 @@ public:
EventVisibility aVisibility)
{
MOZ_ASSERT(aSeekJob.mTarget->IsAccurate() || aSeekJob.mTarget->IsFast());
mCurrentTimeBeforeSeek = TimeUnit::FromMicroseconds(mMaster->GetMediaTime());
return SeekingState::Enter(Move(aSeekJob), aVisibility);
}
@ -994,24 +987,17 @@ public:
}
private:
void CreateSeekTask() override
void DoSeek() override
{
mCurrentTimeBeforeSeek = TimeUnit::FromMicroseconds(mMaster->GetMediaTime());
mDoneAudioSeeking = !Info().HasAudio() || mSeekJob.mTarget->IsVideoOnly();
mDoneVideoSeeking = !Info().HasVideo();
}
void ResetMDSM() override
{
if (mSeekJob.mTarget->IsVideoOnly()) {
mMaster->Reset(TrackInfo::kVideoTrack);
} else {
mMaster->Reset();
}
}
void DoSeek() override
{
// Request the demuxer to perform seek.
mSeekRequest.Begin(Reader()->Seek(mSeekJob.mTarget.ref())
->Then(OwnerThread(), __func__,
@ -1271,6 +1257,8 @@ public:
EventVisibility aVisibility)
{
MOZ_ASSERT(aSeekJob.mTarget->IsNextFrame());
mCurrentTime = mMaster->GetMediaTime();
mDuration = mMaster->Duration();
return SeekingState::Enter(Move(aSeekJob), aVisibility);
}
@ -1326,17 +1314,6 @@ private:
NextFrameSeekingState* mStateObj;
};
void CreateSeekTask() override
{
mCurrentTime = mMaster->GetMediaTime();
mDuration = mMaster->Duration();
}
void ResetMDSM() override
{
// Do nothing.
}
void DoSeek() override
{
// We need to do the seek operation asynchronously. Because for a special