Bug 1319706. Part 1 - remove DecodingFirstFrameState::mPendingSeek since it can handle seek requests immediately. r=kaku

MozReview-Commit-ID: I2lI63s46GQ

--HG--
extra : rebase_source : d702fbf9df841c18e3e1a239c6cc6226962f4550
extra : intermediate-source : 9d04eecdff11d055c2924b17c435b9b8aa1fb685
extra : source : ff0d8dde1bd4165f58f064d0320b042c922b0764
This commit is contained in:
JW Wang 2016-11-23 17:48:48 +08:00
Родитель dacb8b20f1
Коммит 7298031ae0
1 изменённых файлов: 3 добавлений и 45 удалений

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

@ -462,7 +462,7 @@ private:
*
* Transition to:
* SHUTDOWN if any decode error.
* SEEKING if any pending seek and seek is possible.
* SEEKING if any seek request.
* DECODING when the 'loadeddata' event is fired.
*/
class MediaDecoderStateMachine::DecodingFirstFrameState
@ -473,13 +473,6 @@ public:
void Enter(SeekJob aPendingSeek);
void Exit() override
{
// mPendingSeek is either moved before transition to SEEKING,
// or should be rejected here before transition to SHUTDOWN.
mPendingSeek.RejectIfExists(__func__);
}
State GetState() const override
{
return DECODER_STATE_DECODING_FIRSTFRAME;
@ -502,8 +495,6 @@ public:
MaybeFinishDecodeFirstFrame();
}
RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override;
void HandleVideoSuspendTimeout() override
{
// Do nothing for we need to decode the 1st video frame to get the dimensions.
@ -519,8 +510,6 @@ private:
// Notify FirstFrameLoaded if having decoded first frames and
// transition to SEEKING if there is any pending seek, or DECODING otherwise.
void MaybeFinishDecodeFirstFrame();
SeekJob mPendingSeek;
};
/**
@ -1310,9 +1299,7 @@ MediaDecoderStateMachine::
DecodingFirstFrameState::Enter(SeekJob aPendingSeek)
{
// Handle pending seek.
if (aPendingSeek.Exists() &&
(mMaster->mSentFirstFrameLoadedEvent ||
Reader()->ForceZeroStartTime())) {
if (aPendingSeek.Exists()) {
SetState<SeekingState>(Move(aPendingSeek), EventVisibility::Observable);
return;
}
@ -1325,34 +1312,10 @@ DecodingFirstFrameState::Enter(SeekJob aPendingSeek)
MOZ_ASSERT(!mMaster->mVideoDecodeSuspended);
mPendingSeek = Move(aPendingSeek);
// Dispatch tasks to decode first frames.
mMaster->DispatchDecodeTasksIfNeeded();
}
RefPtr<MediaDecoder::SeekPromise>
MediaDecoderStateMachine::
DecodingFirstFrameState::HandleSeek(SeekTarget aTarget)
{
// Should've transitioned to DECODING in Enter()
// if mSentFirstFrameLoadedEvent is true.
MOZ_ASSERT(!mMaster->mSentFirstFrameLoadedEvent);
if (!Reader()->ForceZeroStartTime()) {
SLOG("Not Enough Data to seek at this stage, queuing seek");
mPendingSeek.RejectIfExists(__func__);
mPendingSeek.mTarget = aTarget;
return mPendingSeek.mPromise.Ensure(__func__);
}
// Since ForceZeroStartTime() is true, we should've transitioned to SEEKING
// in Enter() if there is any pending seek.
MOZ_ASSERT(!mPendingSeek.Exists());
return StateObject::HandleSeek(aTarget);
}
void
MediaDecoderStateMachine::
DecodingFirstFrameState::MaybeFinishDecodeFirstFrame()
@ -1365,12 +1328,7 @@ DecodingFirstFrameState::MaybeFinishDecodeFirstFrame()
}
mMaster->FinishDecodeFirstFrame();
if (mPendingSeek.Exists()) {
SetState<SeekingState>(Move(mPendingSeek), EventVisibility::Observable);
} else {
SetState<DecodingState>();
}
SetState<DecodingState>();
}
void