summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2022-04-21 14:39:44 -0500
committerMatt A. Tobin <email@mattatobin.com>2022-04-21 14:39:44 -0500
commit1ea6ae4ddbb56ace7496e05160e61c4fb8ad9a21 (patch)
tree407a206f5a06ea4e0c3ae0ee5f0dee135575ef21 /dom
parentb5cf6b9b3f577ad7d08205dab34cf4a812088fde (diff)
downloadaura-central-1ea6ae4ddbb56ace7496e05160e61c4fb8ad9a21.tar.gz
Issue #25 - Part 15: Remove DOM Media code relating to the WAIT_FOR_CDM state
Diffstat (limited to 'dom')
-rw-r--r--dom/media/MediaDecoderStateMachine.cpp83
-rw-r--r--dom/media/MediaDecoderStateMachine.h2
-rw-r--r--dom/media/MediaFormatReader.cpp10
-rw-r--r--dom/media/MediaFormatReader.h2
-rw-r--r--dom/media/platforms/PlatformDecoderModule.h1
5 files changed, 3 insertions, 95 deletions
diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp
index a3d033a06..6e0fea363 100644
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -189,7 +189,6 @@ public:
virtual State GetState() const = 0;
// Event handlers for various events.
- virtual void HandleCDMProxyReady() {}
virtual void HandleAudioDecoded(MediaData* aAudio) {}
virtual void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) {}
virtual void HandleEndOfStream() {}
@@ -268,7 +267,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
@@ -339,60 +337,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:
@@ -1228,28 +1172,13 @@ 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 = false;
-
- mMaster->mNotifyMetadataBeforeFirstFrame =
- mMaster->mDuration.Ref().isSome() || waitingForCDM;
+ mMaster->mNotifyMetadataBeforeFirstFrame = 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
@@ -1265,13 +1194,6 @@ DormantState::HandlePlayStateChanged(MediaDecoder::PlayState aPlayState)
void
MediaDecoderStateMachine::
-WaitForCDMState::HandleCDMProxyReady()
-{
- SetState<DecodingFirstFrameState>(Move(mPendingSeek));
-}
-
-void
-MediaDecoderStateMachine::
DecodingFirstFrameState::Enter(SeekJob aPendingSeek)
{
// Handle pending seek.
@@ -2245,7 +2167,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";
diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h
index f0a37d35f..758db05e8 100644
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -156,7 +156,6 @@ public:
// Enumeration for the valid decoding states
enum State {
DECODER_STATE_DECODING_METADATA,
- DECODER_STATE_WAIT_FOR_CDM,
DECODER_STATE_DORMANT,
DECODER_STATE_DECODING_FIRSTFRAME,
DECODER_STATE_DECODING,
@@ -264,7 +263,6 @@ public:
private:
class StateObject;
class DecodeMetadataState;
- class WaitForCDMState;
class DormantState;
class DecodingFirstFrameState;
class DecodingState;
diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp
index 8e872dd04..411b84e09 100644
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -577,12 +577,6 @@ MediaFormatReader::InitInternal()
return NS_OK;
}
-bool
-MediaFormatReader::IsWaitingOnCDMResource() {
- MOZ_ASSERT(OnTaskQueue());
- return false;
-}
-
RefPtr<MediaDecoderReader::MetadataPromise>
MediaFormatReader::AsyncReadMetadata()
{
@@ -618,9 +612,7 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
UniquePtr<MetadataTags> tags(MakeUnique<MetadataTags>());
RefPtr<PDMFactory> platform;
- if (!IsWaitingOnCDMResource()) {
- platform = new PDMFactory();
- }
+ platform = new PDMFactory();
// To decode, we need valid video and a place to put it.
bool videoActive = !!mDemuxer->GetNumberTracks(TrackInfo::kVideoTrack) &&
diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h
index fe3c3798d..7648a42a5 100644
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -101,8 +101,6 @@ private:
bool HasVideo() const { return mVideo.mTrackDemuxer; }
bool HasAudio() const { return mAudio.mTrackDemuxer; }
- bool IsWaitingOnCDMResource();
-
bool InitDemuxer();
// Notify the demuxer that new data has been received.
// The next queued task calling GetBuffered() is guaranteed to have up to date
diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h
index a81e7f864..8e1d2f785 100644
--- a/dom/media/platforms/PlatformDecoderModule.h
+++ b/dom/media/platforms/PlatformDecoderModule.h
@@ -38,7 +38,6 @@ class RemoteDecoderModule;
class MediaDataDecoder;
class MediaDataDecoderCallback;
class TaskQueue;
-class CDMProxy;
static LazyLogModule sPDMLog("PlatformDecoderModule");