зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1310537 - delay dormant handling until we exit WaitForCDMState. r=kikuo
The purpose of dormant state is to release decoders. we can delay handling dormant until we really need to decode. MozReview-Commit-ID: GW4y8d40DLi --HG-- extra : rebase_source : d915fafcf6e7f6c4456c1dd26f4178758572d25a extra : source : 8fabc1fe05e348a15a671c1bbbf1e11562f80fe5
This commit is contained in:
Родитель
f8b3c4b650
Коммит
4ba6bbd9e5
|
@ -331,7 +331,7 @@ class MediaDecoderStateMachine::WaitForCDMState
|
|||
public:
|
||||
explicit WaitForCDMState(Master* aPtr) : StateObject(aPtr) {}
|
||||
|
||||
void Enter() {}
|
||||
void Enter(bool aPendingDormant) { mPendingDormant = aPendingDormant; }
|
||||
|
||||
State GetState() const override
|
||||
{
|
||||
|
@ -349,6 +349,9 @@ public:
|
|||
mMaster->mQueuedSeek.mTarget = aTarget;
|
||||
return mMaster->mQueuedSeek.mPromise.Ensure(__func__);
|
||||
}
|
||||
|
||||
private:
|
||||
bool mPendingDormant = false;
|
||||
};
|
||||
|
||||
class MediaDecoderStateMachine::DormantState
|
||||
|
@ -976,30 +979,26 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata)
|
|||
mMaster->EnqueueLoadedMetadataEvent();
|
||||
}
|
||||
|
||||
if (mPendingDormant) {
|
||||
// No need to store mQueuedSeek because we are at position 0.
|
||||
SetState<DormantState>();
|
||||
return;
|
||||
}
|
||||
|
||||
if (waitingForCDM) {
|
||||
// Metadata parsing was successful but we're still waiting for CDM caps
|
||||
// to become available so that we can build the correct decryptor/decoder.
|
||||
SetState<WaitForCDMState>();
|
||||
return;
|
||||
}
|
||||
|
||||
SetState<DecodingFirstFrameState>();
|
||||
// FIXME: passing data members to SetState() will cause UAF because |this|
|
||||
// is deleted before the call to newState::Enter().
|
||||
bool pendingDormant = mPendingDormant;
|
||||
SetState<WaitForCDMState>(pendingDormant);
|
||||
} else if (mPendingDormant) {
|
||||
SetState<DormantState>();
|
||||
} else {
|
||||
SetState<DecodingFirstFrameState>();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MediaDecoderStateMachine::
|
||||
WaitForCDMState::HandleDormant(bool aDormant)
|
||||
{
|
||||
if (aDormant) {
|
||||
// No need to store mQueuedSeek because we are at position 0.
|
||||
SetState<DormantState>();
|
||||
}
|
||||
mPendingDormant = aDormant;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1008,12 +1007,8 @@ MediaDecoderStateMachine::
|
|||
DormantState::HandleDormant(bool aDormant)
|
||||
{
|
||||
if (!aDormant) {
|
||||
// Exit dormant state. Check if we need the CDMProxy to start decoding.
|
||||
if (Info().IsEncrypted() && !mMaster->mCDMProxy) {
|
||||
SetState<WaitForCDMState>();
|
||||
} else {
|
||||
SetState<DecodingFirstFrameState>();
|
||||
}
|
||||
MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy);
|
||||
SetState<DecodingFirstFrameState>();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1022,7 +1017,11 @@ bool
|
|||
MediaDecoderStateMachine::
|
||||
WaitForCDMState::HandleCDMProxyReady()
|
||||
{
|
||||
SetState<DecodingFirstFrameState>();
|
||||
if (mPendingDormant) {
|
||||
SetState<DormantState>();
|
||||
} else {
|
||||
SetState<DecodingFirstFrameState>();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче