Bug 1308147. Part 1 - add WaitForCDMState::mPendingSeek to store a pending seek job.
MozReview-Commit-ID: LmSSm98k9Ze
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -366,49 +366,61 @@ class MediaDecoderStateMachine::WaitForC
: public MediaDecoderStateMachine::StateObject
{
public:
explicit WaitForCDMState(Master* aPtr) : StateObject(aPtr) {}
void Enter(bool aPendingDormant)
{
MOZ_ASSERT(!mMaster->mVideoDecodeSuspended);
+
+ // WAIT_FOR_CDM is transitioned from DECODING_METADATA
+ // where mQueuedSeek must be empty.
+ MOZ_ASSERT(!mMaster->mQueuedSeek.Exists());
+
mPendingDormant = aPendingDormant;
}
+ void Exit() override
+ {
+ // Transfer the seek job so it is available to the next state.
+ mMaster->mQueuedSeek = Move(mPendingSeek);
+ }
+
State GetState() const override
{
return DECODER_STATE_WAIT_FOR_CDM;
}
bool HandleDormant(bool aDormant) override;
bool HandleCDMProxyReady() override;
RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override
{
SLOG("Not Enough Data to seek at this stage, queuing seek");
- mMaster->mQueuedSeek.RejectIfExists(__func__);
- mMaster->mQueuedSeek.mTarget = aTarget;
- return mMaster->mQueuedSeek.mPromise.Ensure(__func__);
+ mPendingSeek.RejectIfExists(__func__);
+ mPendingSeek.mTarget = aTarget;
+ return mPendingSeek.mPromise.Ensure(__func__);
}
void HandleVideoSuspendTimeout() override
{
// Do nothing since no decoders are created yet.
}
void HandleResumeVideoDecoding() override
{
// We never suspend video decoding in this state.
MOZ_ASSERT(false, "Shouldn't have suspended video decoding.");
}
private:
bool mPendingDormant = false;
+ SeekJob mPendingSeek;
};
/**
* Purpose: release decoder resources to save memory and hardware resources.
*
* Transition to:
* DECODING_FIRSTFRAME when being asked to exit dormant.
*/