summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2022-04-21 02:18:57 -0500
committerMatt A. Tobin <email@mattatobin.com>2022-04-21 02:18:57 -0500
commit9b03443b6a227c09e62fa393d4a413005691f8ad (patch)
tree83ca0d8978735cdf8741342a248eec38c0b17c78
parent0c7843d82b2ac8d73c0a6fb69865d086fc1f81b2 (diff)
downloadaura-central-9b03443b6a227c09e62fa393d4a413005691f8ad.tar.gz
Issue #25 - Part 13: Remove EME from dom/media and HTMLMediaElement.webidl
-rw-r--r--dom/media/AbstractMediaDecoder.h3
-rw-r--r--dom/media/MediaDecoder.cpp24
-rw-r--r--dom/media/MediaDecoder.h19
-rw-r--r--dom/media/MediaDecoderOwner.h8
-rw-r--r--dom/media/MediaDecoderReader.h7
-rw-r--r--dom/media/MediaDecoderReaderWrapper.h4
-rw-r--r--dom/media/MediaDecoderStateMachine.cpp40
-rw-r--r--dom/media/MediaDecoderStateMachine.h7
-rw-r--r--dom/media/MediaFormatReader.cpp60
-rw-r--r--dom/media/MediaFormatReader.h12
-rw-r--r--dom/media/gtest/MockMediaDecoderOwner.h4
-rw-r--r--dom/webidl/HTMLMediaElement.webidl18
12 files changed, 1 insertions, 205 deletions
diff --git a/dom/media/AbstractMediaDecoder.h b/dom/media/AbstractMediaDecoder.h
index 6babcce17..c38de81af 100644
--- a/dom/media/AbstractMediaDecoder.h
+++ b/dom/media/AbstractMediaDecoder.h
@@ -31,9 +31,6 @@ class MediaResource;
class ReentrantMonitor;
class VideoFrameContainer;
class MediaDecoderOwner;
-#ifdef MOZ_EME
-class CDMProxy;
-#endif
typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp
index 10b97f7e6..ebc694b47 100644
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -386,9 +386,6 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
, mLogicalPosition(0.0)
, mDuration(std::numeric_limits<double>::quiet_NaN())
, mResourceCallback(new ResourceCallback())
-#ifdef MOZ_EME
- , mCDMProxyPromise(mCDMProxyPromiseHolder.Ensure(__func__))
-#endif
, mIgnoreProgressData(false)
, mInfiniteStream(false)
, mOwner(aOwner)
@@ -473,10 +470,6 @@ MediaDecoder::Shutdown()
mResourceCallback->Disconnect();
-#ifdef MOZ_EME
- mCDMProxyPromiseHolder.RejectIfExists(true, __func__);
-#endif
-
DiscardOngoingSeekIfExists();
// This changes the decoder state to SHUTDOWN and does other things
@@ -1547,23 +1540,6 @@ MediaDecoder::CanPlayThrough()
return GetStatistics().CanPlayThrough();
}
-#ifdef MOZ_EME
-RefPtr<MediaDecoder::CDMProxyPromise>
-MediaDecoder::RequestCDMProxy() const
-{
- return mCDMProxyPromise;
-}
-
-void
-MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
-{
- MOZ_ASSERT(NS_IsMainThread());
- MOZ_ASSERT(aProxy);
-
- mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__);
-}
-#endif
-
bool
MediaDecoder::IsOpusEnabled()
{
diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h
index 298552433..3c409b118 100644
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -9,10 +9,6 @@
#include "mozilla/Atomics.h"
-#ifdef MOZ_EME
-#include "mozilla/CDMProxy.h"
-#endif
-
#include "mozilla/MozPromise.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/StateMirroring.h"
@@ -436,16 +432,6 @@ private:
MediaDecoderOwner* GetOwner() const override;
-#ifdef MOZ_EME
- typedef MozPromise<RefPtr<CDMProxy>, bool /* aIgnored */, /* IsExclusive = */ true> CDMProxyPromise;
-
- // Resolved when a CDMProxy is available and the capabilities are known or
- // rejected when this decoder is about to shut down.
- RefPtr<CDMProxyPromise> RequestCDMProxy() const;
-
- void SetCDMProxy(CDMProxy* aProxy);
-#endif
-
static bool IsOggEnabled();
static bool IsOpusEnabled();
static bool IsWaveEnabled();
@@ -595,11 +581,6 @@ private:
RefPtr<ResourceCallback> mResourceCallback;
-#ifdef MOZ_EME
- MozPromiseHolder<CDMProxyPromise> mCDMProxyPromiseHolder;
- RefPtr<CDMProxyPromise> mCDMProxyPromise;
-#endif
-
protected:
// The promise resolving/rejection is queued as a "micro-task" which will be
// handled immediately after the current JS task and before any pending JS
diff --git a/dom/media/MediaDecoderOwner.h b/dom/media/MediaDecoderOwner.h
index f993b4324..649d2996f 100644
--- a/dom/media/MediaDecoderOwner.h
+++ b/dom/media/MediaDecoderOwner.h
@@ -142,14 +142,6 @@ public:
// The decoder owner should call Shutdown() on the decoder and drop the
// reference to the decoder to prevent further calls into the decoder.
virtual void NotifyXPCOMShutdown() = 0;
-
-#ifdef MOZ_EME
- // Dispatches a "encrypted" event to the HTMLMediaElement, with the
- // provided init data. Actual dispatch may be delayed until HAVE_METADATA.
- // Main thread only.
- virtual void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
- const nsAString& aInitDataType) = 0;
-#endif
};
} // namespace mozilla
diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h
index dd406ed90..3a3e2ceb8 100644
--- a/dom/media/MediaDecoderReader.h
+++ b/dom/media/MediaDecoderReader.h
@@ -24,9 +24,6 @@
namespace mozilla {
-#ifdef MOZ_EME
-class CDMProxy;
-#endif
class MediaDecoderReader;
struct WaitForDataRejectValue
@@ -188,10 +185,6 @@ public:
// when to call SetIdle().
virtual void SetIdle() {}
-#ifdef MOZ_EME
- virtual void SetCDMProxy(CDMProxy* aProxy) {}
-#endif
-
// Tell the reader that the data decoded are not for direct playback, so it
// can accept more files, in particular those which have more channels than
// available in the audio output.
diff --git a/dom/media/MediaDecoderReaderWrapper.h b/dom/media/MediaDecoderReaderWrapper.h
index a0f845538..c85c93d44 100644
--- a/dom/media/MediaDecoderReaderWrapper.h
+++ b/dom/media/MediaDecoderReaderWrapper.h
@@ -112,10 +112,6 @@ public:
return mReader->CanonicalBuffered();
}
-#ifdef MOZ_EME
- void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); }
-#endif
-
void SetVideoBlankDecode(bool aIsBlankDecode);
private:
diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp
index c5113bed4..a3d033a06 100644
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1234,12 +1234,7 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata)
// 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
+ bool waitingForCDM = false;
mMaster->mNotifyMetadataBeforeFirstFrame =
mMaster->mDuration.Ref().isSome() || waitingForCDM;
@@ -1263,9 +1258,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);
}
@@ -1578,10 +1570,6 @@ ShutdownState::Enter()
// dispose of the timer.
master->mVideoDecodeSuspendTimer.Reset();
-#ifdef MOZ_EME
- master->mCDMProxyPromise.DisconnectIfExists();
-#endif
-
if (master->IsPlaying()) {
master->StopPlayback();
}
@@ -2134,13 +2122,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);
@@ -3115,25 +3096,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)
{
diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h
index f04f34983..f0a37d35f 100644
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -768,13 +768,6 @@ private:
// Playback will not start when audio is offloading.
bool mAudioOffloading;
-#ifdef MOZ_EME
- void OnCDMProxyReady(RefPtr<CDMProxy> aProxy);
- void OnCDMProxyNotReady();
- RefPtr<CDMProxy> mCDMProxy;
- MozPromiseRequestHolder<MediaDecoder::CDMProxyPromise> mCDMProxyPromise;
-#endif
-
private:
// The buffered range. Mirrored from the decoder thread.
Mirror<media::TimeIntervals> mBuffered;
diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp
index 98ba57a6e..b9289e82a 100644
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -3,10 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifdef MOZ_EME
-#include "mozilla/CDMProxy.h"
-#endif
-
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/Preferences.h"
@@ -351,12 +347,7 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack)
if (!mOwner->mPlatform) {
mOwner->mPlatform = new PDMFactory();
if (mOwner->IsEncrypted()) {
-#ifdef MOZ_EME
- MOZ_ASSERT(mOwner->mCDMProxy);
- mOwner->mPlatform->SetCDMProxy(mOwner->mCDMProxy);
-#else
return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, "EME not supported");
-#endif
}
}
@@ -586,54 +577,10 @@ MediaFormatReader::InitInternal()
return NS_OK;
}
-#ifdef MOZ_EME
-class DispatchKeyNeededEvent : public Runnable {
-public:
- DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder,
- nsTArray<uint8_t>& aInitData,
- const nsString& aInitDataType)
- : mDecoder(aDecoder)
- , mInitData(aInitData)
- , mInitDataType(aInitDataType)
- {
- }
- NS_IMETHOD Run() override {
- // Note: Null check the owner, as the decoder could have been shutdown
- // since this event was dispatched.
- MediaDecoderOwner* owner = mDecoder->GetOwner();
- if (owner) {
- owner->DispatchEncrypted(mInitData, mInitDataType);
- }
- mDecoder = nullptr;
- return NS_OK;
- }
-private:
- RefPtr<AbstractMediaDecoder> mDecoder;
- nsTArray<uint8_t> mInitData;
- nsString mInitDataType;
-};
-
-void
-MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
-{
- RefPtr<CDMProxy> proxy = aProxy;
- RefPtr<MediaFormatReader> self = this;
- nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
- MOZ_ASSERT(self->OnTaskQueue());
- self->mCDMProxy = proxy;
- });
- OwnerThread()->Dispatch(r.forget());
-}
-#endif // MOZ_EME
-
bool
MediaFormatReader::IsWaitingOnCDMResource() {
MOZ_ASSERT(OnTaskQueue());
-#ifdef MOZ_EME
- return IsEncrypted() && !mCDMProxy;
-#else
return false;
-#endif
}
RefPtr<MediaDecoderReader::MetadataPromise>
@@ -740,13 +687,6 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
UniquePtr<EncryptionInfo> crypto = mDemuxer->GetCrypto();
if (mDecoder && crypto && crypto->IsEncrypted()) {
-#ifdef MOZ_EME
- // Try and dispatch 'encrypted'. Won't go if ready state still HAVE_NOTHING.
- for (uint32_t i = 0; i < crypto->mInitDatas.Length(); i++) {
- NS_DispatchToMainThread(
- new DispatchKeyNeededEvent(mDecoder, crypto->mInitDatas[i].mInitData, crypto->mInitDatas[i].mType));
- }
-#endif
mInfo.mCrypto = *crypto;
}
diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h
index be0b7cd17..6e83c9e70 100644
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -20,10 +20,6 @@
namespace mozilla {
-#ifdef MOZ_EME
-class CDMProxy;
-#endif
-
class MediaFormatReader final : public MediaDecoderReader
{
typedef TrackInfo::TrackType TrackType;
@@ -93,10 +89,6 @@ public:
return mTrackDemuxersMayBlock;
}
-#ifdef MOZ_EME
- void SetCDMProxy(CDMProxy* aProxy) override;
-#endif
-
// Returns a string describing the state of the decoder data.
// Used for debugging purposes.
void GetMozDebugReaderData(nsAString& aString);
@@ -588,10 +580,6 @@ private:
RefPtr<VideoFrameContainer> mVideoFrameContainer;
layers::ImageContainer* GetImageContainer();
-#ifdef MOZ_EME
- RefPtr<CDMProxy> mCDMProxy;
-#endif
-
RefPtr<GMPCrashHelper> mCrashHelper;
void SetBlankDecode(TrackType aTrack, bool aIsBlankDecode);
diff --git a/dom/media/gtest/MockMediaDecoderOwner.h b/dom/media/gtest/MockMediaDecoderOwner.h
index 1009ca30a..64d729018 100644
--- a/dom/media/gtest/MockMediaDecoderOwner.h
+++ b/dom/media/gtest/MockMediaDecoderOwner.h
@@ -34,10 +34,6 @@ public:
void DownloadProgressed() override {}
void UpdateReadyState() override {}
void FirstFrameLoaded() override {}
-#ifdef MOZ_EME
- void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
- const nsAString& aInitDataType) override {}
-#endif
bool IsActive() const override { return true; }
bool IsHidden() const override { return false; }
void DownloadSuspended() override {}
diff --git a/dom/webidl/HTMLMediaElement.webidl b/dom/webidl/HTMLMediaElement.webidl
index ad31f38cb..7f0f9f857 100644
--- a/dom/webidl/HTMLMediaElement.webidl
+++ b/dom/webidl/HTMLMediaElement.webidl
@@ -153,24 +153,6 @@ partial interface HTMLMediaElement {
attribute EventHandler onmozinterruptend;
};
-#ifdef MOZ_EME
-// Encrypted Media Extensions
-partial interface HTMLMediaElement {
- [Pref="media.eme.apiVisible"]
- readonly attribute MediaKeys? mediaKeys;
-
- // void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457
- [Pref="media.eme.apiVisible", NewObject]
- Promise<void> setMediaKeys(MediaKeys? mediaKeys);
-
- [Pref="media.eme.apiVisible"]
- attribute EventHandler onencrypted;
-
- [Pref="media.eme.apiVisible"]
- attribute EventHandler onwaitingforkey;
-};
-#endif
-
// This is just for testing
partial interface HTMLMediaElement {
[Pref="media.useAudioChannelService.testing"]