Bug 1307699. Part 5 - move mSeekTask into SeekingState. r=kaku

MozReview-Commit-ID: AdVCoOPDG4F

--HG--
extra : rebase_source : 02c2ae4aab3e083ea25b660e263d0f96583c7b14
This commit is contained in:
JW Wang 2016-10-05 14:59:24 +08:00
Родитель 52c66ad894
Коммит 24c5c9be4b
2 изменённых файлов: 11 добавлений и 13 удалений

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

@ -677,11 +677,11 @@ public:
// Create a new SeekTask instance for the incoming seek task.
if (mSeekJob.mTarget.IsAccurate() ||
mSeekJob.mTarget.IsFast()) {
mMaster->mSeekTask = new AccurateSeekTask(
mSeekTask = new AccurateSeekTask(
mMaster->mDecoderID, OwnerThread(), Reader(), mSeekJob.mTarget,
mMaster->mInfo, mMaster->Duration(), mMaster->GetMediaTime());
} else if (mSeekJob.mTarget.IsNextFrame()) {
mMaster->mSeekTask = new NextFrameSeekTask(
mSeekTask = new NextFrameSeekTask(
mMaster->mDecoderID, OwnerThread(), Reader(), mSeekJob.mTarget,
mMaster->mInfo, mMaster->Duration(),mMaster->GetMediaTime(),
mMaster->AudioQueue(), mMaster->VideoQueue());
@ -699,7 +699,7 @@ public:
// seek target to [0, duration]. We want to update the playback position to
// the clamped value.
mMaster->UpdatePlaybackPositionInternal(
mMaster->mSeekTask->GetSeekTarget().GetTime().ToMicroseconds());
mSeekTask->GetSeekTarget().GetTime().ToMicroseconds());
if (mSeekJob.mTarget.mEventVisibility ==
MediaDecoderEventVisibility::Observable) {
@ -707,7 +707,7 @@ public:
}
// Reset our state machine and decoding pipeline before seeking.
if (mMaster->mSeekTask->NeedToResetMDSM()) {
if (mSeekTask->NeedToResetMDSM()) {
if (mSeekJob.mTarget.IsVideoOnly()) {
mMaster->Reset(TrackInfo::kVideoTrack);
} else {
@ -716,7 +716,7 @@ public:
}
// Do the seek.
mSeekTaskRequest.Begin(mMaster->mSeekTask->Seek(mMaster->Duration())
mSeekTaskRequest.Begin(mSeekTask->Seek(mMaster->Duration())
->Then(OwnerThread(), __func__,
[this] (const SeekTaskResolveValue& aValue) {
OnSeekTaskResolved(aValue);
@ -734,10 +734,10 @@ public:
{
mSeekTaskRequest.DisconnectIfExists();
if (mMaster->mSeekTask) {
if (mSeekTask) {
mMaster->mCurrentSeek.RejectIfExists(__func__);
mMaster->mSeekTask->Discard();
mMaster->mSeekTask = nullptr;
mSeekTask->Discard();
mSeekTask = nullptr;
// Reset the MediaDecoderReaderWrapper's callbask.
mMaster->SetMediaDecoderReaderWrapperCallback();
@ -837,7 +837,7 @@ private:
void SeekCompleted()
{
int64_t seekTime = mMaster->mSeekTask->GetSeekTarget().GetTime().ToMicroseconds();
int64_t seekTime = mSeekTask->GetSeekTarget().GetTime().ToMicroseconds();
int64_t newCurrentTime = seekTime;
// Setup timestamp state.
@ -911,6 +911,7 @@ private:
SeekJob mSeekJob;
MozPromiseRequestHolder<SeekTask::SeekTaskPromise> mSeekTaskRequest;
RefPtr<SeekTask> mSeekTask;
};
class MediaDecoderStateMachine::BufferingState
@ -2142,7 +2143,7 @@ void MediaDecoderStateMachine::VisibilityChanged()
// If an existing seek is in flight don't bother creating a new
// one to catch up.
if (mSeekTask || mQueuedSeek.Exists()) {
if (mState == DECODER_STATE_SEEKING || mQueuedSeek.Exists()) {
return;
}

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

@ -619,9 +619,6 @@ private:
SeekJob mQueuedSeek;
SeekJob mCurrentSeek;
// mSeekTask is responsible for executing the current seek request.
RefPtr<SeekTask> mSeekTask;
// Media Fragment end time in microseconds. Access controlled by decoder monitor.
int64_t mFragmentEndTime;