summaryrefslogtreecommitdiff
path: root/dom/media/MediaDecoderStateMachine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/MediaDecoderStateMachine.cpp')
-rw-r--r--dom/media/MediaDecoderStateMachine.cpp119
1 files changed, 2 insertions, 117 deletions
diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp
index b84a76d624..dc82e89e34 100644
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -271,7 +271,6 @@ protected:
*
* Transition to other states when decoding metadata is done:
* SHUTDOWN if failing to decode metadata.
- * WAIT_FOR_CDM if the media is encrypted and CDM is not available.
* DECODING_FIRSTFRAME otherwise.
*/
class MediaDecoderStateMachine::DecodeMetadataState
@@ -342,60 +341,6 @@ private:
};
/**
- * Purpose: wait for the CDM to start decoding.
- *
- * Transition to other states when CDM is ready:
- * DECODING_FIRSTFRAME otherwise.
- */
-class MediaDecoderStateMachine::WaitForCDMState
- : public MediaDecoderStateMachine::StateObject
-{
-public:
- explicit WaitForCDMState(Master* aPtr) : StateObject(aPtr) {}
-
- void Enter()
- {
- MOZ_ASSERT(!mMaster->mVideoDecodeSuspended);
- }
-
- void Exit() override
- {
- // mPendingSeek is either moved in HandleCDMProxyReady() or should be
- // rejected here before transition to SHUTDOWN.
- mPendingSeek.RejectIfExists(__func__);
- }
-
- State GetState() const override
- {
- return DECODER_STATE_WAIT_FOR_CDM;
- }
-
- void HandleCDMProxyReady() override;
-
- RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override
- {
- SLOG("Not Enough Data to seek at this stage, queuing seek");
- 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:
- SeekJob mPendingSeek;
-};
-
-/**
* Purpose: release decoder resources to save memory and hardware resources.
*
* Transition to:
@@ -1231,33 +1176,14 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata)
mMaster->GetAmpleVideoFrames());
}
- // In general, we wait until we know the duration before notifying the decoder.
- // However, we notify unconditionally in this case without waiting for the start
- // time, since the caller might be waiting on metadataloaded to be fired before
- // feeding in the CDM, which we need to decode the first frame (and
- // thus get the metadata). We could fix this if we could compute the start
- // time by demuxing without necessaring decoding.
- bool waitingForCDM =
-#ifdef MOZ_EME
- mMaster->Info().IsEncrypted() && !mMaster->mCDMProxy;
-#else
- false;
-#endif
-
mMaster->mNotifyMetadataBeforeFirstFrame =
- mMaster->mDuration.Ref().isSome() || waitingForCDM;
+ mMaster->mDuration.Ref().isSome();
if (mMaster->mNotifyMetadataBeforeFirstFrame) {
mMaster->EnqueueLoadedMetadataEvent();
}
- 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>();
- } else {
- SetState<DecodingFirstFrameState>(SeekJob{});
- }
+ SetState<DecodingFirstFrameState>(SeekJob{});
}
void
@@ -1266,9 +1192,6 @@ DormantState::HandlePlayStateChanged(MediaDecoder::PlayState aPlayState)
{
if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) {
// Exit dormant when the user wants to play.
-#ifdef MOZ_EME
- MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy);
-#endif
MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent);
SetState<SeekingState>(Move(mPendingSeek), EventVisibility::Suppressed);
}
@@ -1276,13 +1199,6 @@ DormantState::HandlePlayStateChanged(MediaDecoder::PlayState aPlayState)
void
MediaDecoderStateMachine::
-WaitForCDMState::HandleCDMProxyReady()
-{
- SetState<DecodingFirstFrameState>(Move(mPendingSeek));
-}
-
-void
-MediaDecoderStateMachine::
DecodingFirstFrameState::Enter(SeekJob aPendingSeek)
{
// Handle pending seek.
@@ -1581,10 +1497,6 @@ ShutdownState::Enter()
// dispose of the timer.
master->mVideoDecodeSuspendTimer.Reset();
-#ifdef MOZ_EME
- master->mCDMProxyPromise.DisconnectIfExists();
-#endif
-
if (master->IsPlaying()) {
master->StopPlayback();
}
@@ -2137,13 +2049,6 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
mMediaSink = CreateMediaSink(mAudioCaptured);
-#ifdef MOZ_EME
- mCDMProxyPromise.Begin(aDecoder->RequestCDMProxy()->Then(
- OwnerThread(), __func__, this,
- &MediaDecoderStateMachine::OnCDMProxyReady,
- &MediaDecoderStateMachine::OnCDMProxyNotReady));
-#endif
-
nsresult rv = mReader->Init();
NS_ENSURE_SUCCESS(rv, rv);
@@ -2267,7 +2172,6 @@ MediaDecoderStateMachine::ToStateStr(State aState)
{
switch (aState) {
case DECODER_STATE_DECODING_METADATA: return "DECODING_METADATA";
- case DECODER_STATE_WAIT_FOR_CDM: return "WAIT_FOR_CDM";
case DECODER_STATE_DORMANT: return "DORMANT";
case DECODER_STATE_DECODING_FIRSTFRAME: return "DECODING_FIRSTFRAME";
case DECODER_STATE_DECODING: return "DECODING";
@@ -3118,25 +3022,6 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError(nsresult aResult)
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__));
}
-#ifdef MOZ_EME
-void
-MediaDecoderStateMachine::OnCDMProxyReady(RefPtr<CDMProxy> aProxy)
-{
- MOZ_ASSERT(OnTaskQueue());
- mCDMProxyPromise.Complete();
- mCDMProxy = aProxy;
- mReader->SetCDMProxy(aProxy);
- mStateObj->HandleCDMProxyReady();
-}
-
-void
-MediaDecoderStateMachine::OnCDMProxyNotReady()
-{
- MOZ_ASSERT(OnTaskQueue());
- mCDMProxyPromise.Complete();
-}
-#endif
-
void
MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured)
{