From 08406731e57a357418190043eaa83e5d27c11dd0 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 17 Oct 2023 12:56:22 +0200 Subject: Issue #2346 - Remove MOZ_EME conditional code --- dom/base/Navigator.cpp | 141 ----------- dom/base/Navigator.h | 12 - dom/base/nsDocument.cpp | 34 --- dom/base/nsDocument.h | 4 - dom/canvas/CanvasRenderingContext2D.cpp | 7 - dom/html/HTMLMediaElement.cpp | 322 +------------------------- dom/html/HTMLMediaElement.h | 37 --- dom/media/AbstractMediaDecoder.h | 3 - dom/media/MediaDecoder.cpp | 24 -- dom/media/MediaDecoder.h | 19 -- dom/media/MediaDecoderOwner.h | 8 - dom/media/MediaDecoderReader.h | 7 - dom/media/MediaDecoderReaderWrapper.h | 4 - dom/media/MediaDecoderStateMachine.cpp | 37 --- dom/media/MediaDecoderStateMachine.h | 7 - dom/media/MediaFormatReader.cpp | 61 +---- dom/media/MediaFormatReader.h | 16 -- dom/media/MediaPrefs.h | 3 - dom/media/fmp4/MP4Decoder.cpp | 3 - dom/media/gmp/GMPChild.cpp | 9 - dom/media/gmp/GMPDecryptorParent.cpp | 8 +- dom/media/gmp/GMPDecryptorProxy.h | 8 - dom/media/gmp/GMPParent.cpp | 56 ----- dom/media/gmp/moz.build | 15 -- dom/media/gtest/MockMediaDecoderOwner.h | 4 - dom/media/mediasource/TrackBuffersManager.cpp | 36 --- dom/media/moz.build | 3 - dom/media/platforms/PDMFactory.cpp | 14 -- dom/media/platforms/PDMFactory.h | 13 -- dom/media/platforms/PlatformDecoderModule.h | 3 - dom/media/platforms/moz.build | 3 - dom/media/webaudio/AudioContext.cpp | 7 - dom/webidl/HTMLMediaElement.webidl | 18 -- dom/webidl/Navigator.webidl | 9 - 34 files changed, 3 insertions(+), 952 deletions(-) (limited to 'dom') diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 0bf9ccbf45..3a10427b0f 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -91,11 +91,6 @@ #endif #include "mozilla/dom/ContentChild.h" -#ifdef MOZ_EME -#include "mozilla/EMEUtils.h" -#include "mozilla/DetailedPromise.h" -#endif - namespace mozilla { namespace dom { @@ -198,9 +193,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow) -#ifdef MOZ_EME - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeySystemAccessManager) -#endif #ifdef MOZ_GAMEPAD NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepadServiceTest) #endif @@ -261,13 +253,6 @@ Navigator::Invalidate() mServiceWorkerContainer = nullptr; -#ifdef MOZ_EME - if (mMediaKeySystemAccessManager) { - mMediaKeySystemAccessManager->Shutdown(); - mMediaKeySystemAccessManager = nullptr; - } -#endif - #ifdef MOZ_GAMEPAD if (mGamepadServiceTest) { mGamepadServiceTest->Shutdown(); @@ -1504,131 +1489,5 @@ Navigator::GetUserAgent(nsPIDOMWindowInner* aWindow, nsIURI* aURI, return siteSpecificUA->GetUserAgentForURIAndWindow(aURI, aWindow, aUserAgent); } -#ifdef MOZ_EME -static nsCString -ToCString(const nsString& aString) -{ - nsCString str("'"); - str.Append(NS_ConvertUTF16toUTF8(aString)); - str.AppendLiteral("'"); - return str; -} - -static nsCString -ToCString(const MediaKeysRequirement aValue) -{ - nsCString str("'"); - str.Append(nsDependentCString(MediaKeysRequirementValues::strings[static_cast(aValue)].value)); - str.AppendLiteral("'"); - return str; -} - -static nsCString -ToCString(const MediaKeySystemMediaCapability& aValue) -{ - nsCString str; - str.AppendLiteral("{contentType="); - str.Append(ToCString(aValue.mContentType)); - str.AppendLiteral(", robustness="); - str.Append(ToCString(aValue.mRobustness)); - str.AppendLiteral("}"); - return str; -} - -template -static nsCString -ToCString(const Sequence& aSequence) -{ - nsCString str; - str.AppendLiteral("["); - for (size_t i = 0; i < aSequence.Length(); i++) { - if (i != 0) { - str.AppendLiteral(","); - } - str.Append(ToCString(aSequence[i])); - } - str.AppendLiteral("]"); - return str; -} - -template -static nsCString -ToCString(const Optional>& aOptional) -{ - nsCString str; - if (aOptional.WasPassed()) { - str.Append(ToCString(aOptional.Value())); - } else { - str.AppendLiteral("[]"); - } - return str; -} - -static nsCString -ToCString(const MediaKeySystemConfiguration& aConfig) -{ - nsCString str; - str.AppendLiteral("{label="); - str.Append(ToCString(aConfig.mLabel)); - - str.AppendLiteral(", initDataTypes="); - str.Append(ToCString(aConfig.mInitDataTypes)); - - str.AppendLiteral(", audioCapabilities="); - str.Append(ToCString(aConfig.mAudioCapabilities)); - - str.AppendLiteral(", videoCapabilities="); - str.Append(ToCString(aConfig.mVideoCapabilities)); - - str.AppendLiteral(", distinctiveIdentifier="); - str.Append(ToCString(aConfig.mDistinctiveIdentifier)); - - str.AppendLiteral(", persistentState="); - str.Append(ToCString(aConfig.mPersistentState)); - - str.AppendLiteral(", sessionTypes="); - str.Append(ToCString(aConfig.mSessionTypes)); - - str.AppendLiteral("}"); - - return str; -} - -static nsCString -RequestKeySystemAccessLogString(const nsAString& aKeySystem, - const Sequence& aConfigs) -{ - nsCString str; - str.AppendPrintf("Navigator::RequestMediaKeySystemAccess(keySystem='%s' options=", - NS_ConvertUTF16toUTF8(aKeySystem).get()); - str.Append(ToCString(aConfigs)); - str.AppendLiteral(")"); - return str; -} - -already_AddRefed -Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem, - const Sequence& aConfigs, - ErrorResult& aRv) -{ - EME_LOG("%s", RequestKeySystemAccessLogString(aKeySystem, aConfigs).get()); - - nsCOMPtr go = do_QueryInterface(mWindow); - RefPtr promise = - DetailedPromise::Create(go, aRv, - NS_LITERAL_CSTRING("navigator.requestMediaKeySystemAccess")); - if (aRv.Failed()) { - return nullptr; - } - - if (!mMediaKeySystemAccessManager) { - mMediaKeySystemAccessManager = new MediaKeySystemAccessManager(mWindow); - } - - mMediaKeySystemAccessManager->Request(promise, aKeySystem, aConfigs); - return promise.forget(); -} -#endif - } // namespace dom } // namespace mozilla diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index 175940e82d..a61ed10e49 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -18,9 +18,6 @@ #include "nsString.h" #include "nsTArray.h" #include "nsWeakPtr.h" -#ifdef MOZ_EME -#include "mozilla/dom/MediaKeySystemAccessManager.h" -#endif class nsPluginArray; class nsMimeTypeArray; @@ -240,15 +237,6 @@ public: // any, else null. static already_AddRefed GetWindowFromGlobal(JSObject* aGlobal); -#ifdef MOZ_EME - already_AddRefed - RequestMediaKeySystemAccess(const nsAString& aKeySystem, - const Sequence& aConfig, - ErrorResult& aRv); -private: - RefPtr mMediaKeySystemAccessManager; -#endif - private: virtual ~Navigator(); diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 20fbf72983..9b7a8c2721 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -4206,32 +4206,6 @@ nsDocument::SetScopeObject(nsIGlobalObject* aGlobal) } } -#ifdef MOZ_EME -static void -CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME) -{ - nsCOMPtr domMediaElem(do_QueryInterface(aSupports)); - if (domMediaElem) { - nsCOMPtr content(do_QueryInterface(domMediaElem)); - MOZ_ASSERT(content, "aSupports is not a content"); - HTMLMediaElement* mediaElem = static_cast(content.get()); - bool* contains = static_cast(aContainsEME); - if (mediaElem->GetMediaKeys()) { - *contains = true; - } - } -} - -bool -nsDocument::ContainsEMEContent() -{ - bool containsEME = false; - EnumerateActivityObservers(CheckIfContainsEMEContent, - static_cast(&containsEME)); - return containsEME; -} -#endif // MOZ_EME - static void CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE) { @@ -8036,14 +8010,6 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest) } #endif // MOZ_WEBRTC -#ifdef MOZ_EME - // Don't save presentations for documents containing EME content, so that - // CDMs reliably shutdown upon user navigation. - if (ContainsEMEContent()) { - return false; - } -#endif - // Don't save presentations for documents containing MSE content, to // reduce memory usage. if (ContainsMSEContent()) { diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 923fb49ae9..767ab845ba 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -1104,10 +1104,6 @@ public: js::ExpandoAndGeneration mExpandoAndGeneration; -#ifdef MOZ_EME - bool ContainsEMEContent(); -#endif - bool ContainsMSEContent(); protected: diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 1e7eab82b2..d1a618744b 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -5012,13 +5012,6 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage, return; } -#ifdef MOZ_EME - if (video->ContainsRestrictedContent()) { - aError.Throw(NS_ERROR_NOT_AVAILABLE); - return; - } -#endif - uint16_t readyState; if (NS_SUCCEEDED(video->GetReadyState(&readyState)) && readyState < nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA) { diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 6774504a43..9b3b725c67 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -12,9 +12,6 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/MathAlgorithms.h" #include "mozilla/AsyncEventDispatcher.h" -#ifdef MOZ_EME -#include "mozilla/dom/MediaEncryptedEvent.h" -#endif #include "base/basictypes.h" #include "nsIDOMHTMLMediaElement.h" @@ -877,9 +874,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLMediaElement, nsGenericHTM NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTextTrackManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAudioTrackList) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVideoTrackList) -#ifdef MOZ_EME - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaKeys) -#endif NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSelectedVideoStreamTrack) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPendingPlayPromises) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END @@ -905,9 +899,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLMediaElement, nsGenericHTMLE NS_IMPL_CYCLE_COLLECTION_UNLINK(mTextTrackManager) NS_IMPL_CYCLE_COLLECTION_UNLINK(mAudioTrackList) NS_IMPL_CYCLE_COLLECTION_UNLINK(mVideoTrackList) -#ifdef MOZ_EME - NS_IMPL_CYCLE_COLLECTION_UNLINK(mMediaKeys) -#endif NS_IMPL_CYCLE_COLLECTION_UNLINK(mSelectedVideoStreamTrack) NS_IMPL_CYCLE_COLLECTION_UNLINK(mPendingPlayPromises) NS_IMPL_CYCLE_COLLECTION_UNLINK_END @@ -1160,9 +1151,6 @@ void HTMLMediaElement::AbortExistingLoads() mDownloadSuspendedByCache = false; mMediaInfo = MediaInfo(); mIsEncrypted = false; -#ifdef MOZ_EME - mPendingEncryptedInitData.mInitDatas.Clear(); -#endif mWaitingForKey = NOT_WAITING_FOR_KEY; mSourcePointer = nullptr; @@ -1851,20 +1839,6 @@ nsresult HTMLMediaElement::LoadResource() // Set the media element's CORS mode only when loading a resource mCORSMode = AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin)); -#ifdef MOZ_EME - bool isBlob = false; - if (mMediaKeys && - Preferences::GetBool("media.eme.mse-only", true) && - // We only want mediaSource URLs, but they are BlobURL, so we have to - // check the schema and abort if they are not MediaStream or real Blob. - (NS_FAILED(mLoadingSrc->SchemeIs(BLOBURI_SCHEME, &isBlob)) || - !isBlob || - IsMediaStreamURI(mLoadingSrc) || - IsBlobURI(mLoadingSrc))) { - return NS_ERROR_DOM_NOT_SUPPORTED_ERR; - } -#endif - HTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc); if (other && other->mDecoder) { // Clone it. @@ -2780,11 +2754,6 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded, if (!window) { return nullptr; } -#ifdef MOZ_EME - if (ContainsRestrictedContent()) { - return nullptr; - } -#endif if (!mOutputStreams.IsEmpty() && aGraph != mOutputStreams[0].mStream->GetInputStream()->Graph()) { @@ -3981,25 +3950,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder, ms.mFinishWhenEnded); } -#ifdef MOZ_EME - if (mMediaKeys) { - if (mMediaKeys->GetCDMProxy()) { - mDecoder->SetCDMProxy(mMediaKeys->GetCDMProxy()); - } else { - // CDM must have crashed. - ShutdownDecoder(); - return NS_ERROR_FAILURE; - } - } - - MediaEventSource* waitingForKeyProducer = mDecoder->WaitingForKeyEvent(); - // Not every decoder will produce waitingForKey events, only add ones that can - if (waitingForKeyProducer) { - mWaitingForKeyListener = waitingForKeyProducer->Connect( - AbstractThread::MainThread(), this, &HTMLMediaElement::CannotDecryptWaitingForKey); - } -#endif - if (mChannelLoader) { mChannelLoader->Done(); mChannelLoader = nullptr; @@ -4454,11 +4404,7 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo, SetMediaInfo(*aInfo); - mIsEncrypted = aInfo->IsEncrypted() -#ifdef MOZ_EME - || mPendingEncryptedInitData.IsEncrypted() -#endif - ; + mIsEncrypted = aInfo->IsEncrypted(); mTags = aTags.forget(); mLoadedDataFired = false; ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA); @@ -4483,14 +4429,6 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo, "Encrypted content not supported outside of MSE")); return; } - -#ifdef MOZ_EME - // Dispatch a distinct 'encrypted' event for each initData we have. - for (const auto& initData : mPendingEncryptedInitData.mInitDatas) { - DispatchEncrypted(initData.mInitData, initData.mType); - } - mPendingEncryptedInitData.mInitDatas.Clear(); -#endif } mWatchManager.ManualNotify(&HTMLMediaElement::UpdateReadyStateInternal); @@ -5424,29 +5362,12 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE UpdateSrcMediaStreamPlaying(); UpdateAudioChannelPlayingState(); if (aPauseElement) { -#ifdef MOZ_EME - // For EME content, we may force destruction of the CDM client (and CDM - // instance if this is the last client for that CDM instance) and - // the CDM's decoder. This ensures the CDM gets reliable and prompt - // shutdown notifications, as it may have book-keeping it needs - // to do on shutdown. - if (mMediaKeys) { - mMediaKeys->Shutdown(); - mMediaKeys = nullptr; - if (mDecoder) { - ShutdownDecoder(); - } - } -#endif if (mDecoder) { mDecoder->Pause(); mDecoder->Suspend(); } mEventDeliveryPaused = aSuspendEvents; } else { -#ifdef MOZ_EME - MOZ_ASSERT(!mMediaKeys); -#endif if (mDecoder) { mDecoder->Resume(); if (!mPaused && !mDecoder->IsEnded()) { @@ -5483,17 +5404,6 @@ void HTMLMediaElement::NotifyOwnerDocumentActivityChanged() bool pauseElement = ShouldElementBePaused(); SuspendOrResumeElement(pauseElement, !IsActive()); -#ifdef MOZ_EME - // If the owning document has become inactive we should shutdown the CDM. - if (!OwnerDoc()->IsCurrentActiveDocument() && mMediaKeys) { - mMediaKeys->Shutdown(); - mMediaKeys = nullptr; - if (mDecoder) { - ShutdownDecoder(); - } - } -#endif - AddRemoveSelfReference(); } @@ -6254,236 +6164,6 @@ HTMLMediaElement::OnVisibilityChange(Visibility aNewVisibility) } -#ifdef MOZ_EME -MediaKeys* -HTMLMediaElement::GetMediaKeys() const -{ - return mMediaKeys; -} - -bool -HTMLMediaElement::ContainsRestrictedContent() -{ - return GetMediaKeys() != nullptr; -} - -already_AddRefed -HTMLMediaElement::SetMediaKeys(mozilla::dom::MediaKeys* aMediaKeys, - ErrorResult& aRv) -{ - LOG(LogLevel::Debug, ("%p SetMediaKeys(%p) mMediaKeys=%p mDecoder=%p", - this, aMediaKeys, mMediaKeys.get(), mDecoder.get())); - - if (MozAudioCaptured()) { - aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR); - return nullptr; - } - - nsCOMPtr global = - do_QueryInterface(OwnerDoc()->GetInnerWindow()); - if (!global) { - aRv.Throw(NS_ERROR_UNEXPECTED); - return nullptr; - } - RefPtr promise = DetailedPromise::Create(global, aRv, - NS_LITERAL_CSTRING("HTMLMediaElement.setMediaKeys")); - if (aRv.Failed()) { - return nullptr; - } - - // 1. If mediaKeys and the mediaKeys attribute are the same object, - // return a resolved promise. - if (mMediaKeys == aMediaKeys) { - promise->MaybeResolveWithUndefined(); - return promise.forget(); - } - - // Note: Our attaching code is synchronous, so we can skip the following steps. - - // 2. If this object's attaching media keys value is true, return a - // promise rejected with a new DOMException whose name is InvalidStateError. - // 3. Let this object's attaching media keys value be true. - // 4. Let promise be a new promise. - // 5. Run the following steps in parallel: - - // 5.1 If mediaKeys is not null, CDM instance represented by mediaKeys is - // already in use by another media element, and the user agent is unable - // to use it with this element, let this object's attaching media keys - // value be false and reject promise with a new DOMException whose name - // is QuotaExceededError. - if (aMediaKeys && aMediaKeys->IsBoundToMediaElement()) { - promise->MaybeReject(NS_ERROR_DOM_QUOTA_EXCEEDED_ERR, - NS_LITERAL_CSTRING("MediaKeys object is already bound to another HTMLMediaElement")); - return promise.forget(); - } - - // 5.2 If the mediaKeys attribute is not null, run the following steps: - if (mMediaKeys) { - // 5.2.1 If the user agent or CDM do not support removing the association, - // let this object's attaching media keys value be false and reject promise - // with a new DOMException whose name is NotSupportedError. - - // 5.2.2 If the association cannot currently be removed, let this object's - // attaching media keys value be false and reject promise with a new - // DOMException whose name is InvalidStateError. - if (mDecoder) { - // We don't support swapping out the MediaKeys once we've started to - // setup the playback pipeline. Note this also means we don't need to worry - // about handling disassociating the MediaKeys from the MediaDecoder. - promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Can't change MediaKeys on HTMLMediaElement after load has started")); - return promise.forget(); - } - - // 5.2.3 Stop using the CDM instance represented by the mediaKeys attribute - // to decrypt media data and remove the association with the media element. - mMediaKeys->Unbind(); - mMediaKeys = nullptr; - - // 5.2.4 If the preceding step failed, let this object's attaching media - // keys value be false and reject promise with a new DOMException whose - // name is the appropriate error name. - } - - // 5.3. If mediaKeys is not null, run the following steps: - if (aMediaKeys) { - if (!aMediaKeys->GetCDMProxy()) { - promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("CDM crashed before binding MediaKeys object to HTMLMediaElement")); - return promise.forget(); - } - - // 5.3.1 Associate the CDM instance represented by mediaKeys with the - // media element for decrypting media data. - if (NS_FAILED(aMediaKeys->Bind(this))) { - // 5.3.2 If the preceding step failed, run the following steps: - // 5.3.2.1 Set the mediaKeys attribute to null. - mMediaKeys = nullptr; - // 5.3.2.2 Let this object's attaching media keys value be false. - // 5.3.2.3 Reject promise with a new DOMException whose name is - // the appropriate error name. - promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR, - NS_LITERAL_CSTRING("Failed to bind MediaKeys object to HTMLMediaElement")); - return promise.forget(); - } - // 5.3.3 Queue a task to run the "Attempt to Resume Playback If Necessary" - // algorithm on the media element. - // Note: Setting the CDMProxy on the MediaDecoder will unblock playback. - if (mDecoder) { - mDecoder->SetCDMProxy(aMediaKeys->GetCDMProxy()); - } - } - - // 5.4 Set the mediaKeys attribute to mediaKeys. - mMediaKeys = aMediaKeys; - - // 5.5 Let this object's attaching media keys value be false. - - // 5.6 Resolve promise. - promise->MaybeResolveWithUndefined(); - - // 6. Return promise. - return promise.forget(); -} - -EventHandlerNonNull* -HTMLMediaElement::GetOnencrypted() -{ - return EventTarget::GetEventHandler(nsGkAtoms::onencrypted, EmptyString()); -} - -void -HTMLMediaElement::SetOnencrypted(EventHandlerNonNull* aCallback) -{ - EventTarget::SetEventHandler(nsGkAtoms::onencrypted, EmptyString(), aCallback); -} - -EventHandlerNonNull* -HTMLMediaElement::GetOnwaitingforkey() -{ - return EventTarget::GetEventHandler(nsGkAtoms::onwaitingforkey, EmptyString()); -} - -void -HTMLMediaElement::SetOnwaitingforkey(EventHandlerNonNull* aCallback) -{ - EventTarget::SetEventHandler(nsGkAtoms::onwaitingforkey, EmptyString(), aCallback); -} - -void -HTMLMediaElement::DispatchEncrypted(const nsTArray& aInitData, - const nsAString& aInitDataType) -{ - LOG(LogLevel::Debug, - ("%p DispatchEncrypted initDataType='%s'", - this, NS_ConvertUTF16toUTF8(aInitDataType).get())); - - if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) { - // Ready state not HAVE_METADATA (yet), don't dispatch encrypted now. - // Queueing for later dispatch in MetadataLoaded. - mPendingEncryptedInitData.AddInitData(aInitDataType, aInitData); - return; - } - - RefPtr event; - if (IsCORSSameOrigin()) { - event = MediaEncryptedEvent::Constructor(this, aInitDataType, aInitData); - } else { - event = MediaEncryptedEvent::Constructor(this); - } - - RefPtr asyncDispatcher = - new AsyncEventDispatcher(this, event); - asyncDispatcher->PostDOMEvent(); -} - -bool -HTMLMediaElement::IsEventAttributeName(nsIAtom* aName) -{ - return aName == nsGkAtoms::onencrypted || - nsGenericHTMLElement::IsEventAttributeName(aName); -} - -already_AddRefed -HTMLMediaElement::GetTopLevelPrincipal() -{ - RefPtr principal; - nsCOMPtr window = OwnerDoc()->GetInnerWindow(); - if (!window) { - return nullptr; - } - // XXXkhuey better hope we always have an outer ... - nsCOMPtr top = window->GetOuterWindow()->GetTop(); - if (!top) { - return nullptr; - } - nsIDocument* doc = top->GetExtantDoc(); - if (!doc) { - return nullptr; - } - principal = doc->NodePrincipal(); - return principal.forget(); -} - -void -HTMLMediaElement::CannotDecryptWaitingForKey() -{ - LOG(LogLevel::Debug, ("%p, CannotDecryptWaitingForKey()", this)); - - // http://w3c.github.io/encrypted-media/#wait-for-key - // 7.3.4 Queue a "waitingforkey" Event - // 1. Let the media element be the specified HTMLMediaElement object. - // 2. If the media element's waiting for key value is true, abort these steps. - if (mWaitingForKey == NOT_WAITING_FOR_KEY) { - // 3. Set the media element's waiting for key value to true. - // Note: algorithm continues in UpdateReadyStateInternal() when all decoded - // data enqueued in the MDSM is consumed. - mWaitingForKey = WAITING_FOR_KEY; - UpdateReadyStateInternal(); - } -} -#endif //MOZ_EME - NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged(bool aCapture) { MOZ_ASSERT(mAudioChannelAgent); diff --git a/dom/html/HTMLMediaElement.h b/dom/html/HTMLMediaElement.h index bda9924a6f..23799b574c 100644 --- a/dom/html/HTMLMediaElement.h +++ b/dom/html/HTMLMediaElement.h @@ -18,9 +18,6 @@ #include "mozilla/dom/TextTrackManager.h" #include "mozilla/WeakPtr.h" #include "MediaDecoder.h" -#ifdef MOZ_EME -#include "mozilla/dom/MediaKeys.h" -#endif #include "mozilla/StateWatching.h" #include "nsGkAtoms.h" #include "PrincipalChangeObserver.h" @@ -616,30 +613,6 @@ public: // XPCOM MozPreservesPitch() is OK -#ifdef MOZ_EME - MediaKeys* GetMediaKeys() const; - - already_AddRefed SetMediaKeys(MediaKeys* mediaKeys, - ErrorResult& aRv); - - mozilla::dom::EventHandlerNonNull* GetOnencrypted(); - void SetOnencrypted(mozilla::dom::EventHandlerNonNull* aCallback); - - mozilla::dom::EventHandlerNonNull* GetOnwaitingforkey(); - void SetOnwaitingforkey(mozilla::dom::EventHandlerNonNull* aCallback); - - void DispatchEncrypted(const nsTArray& aInitData, - const nsAString& aInitDataType) override; - - bool IsEventAttributeName(nsIAtom* aName) override; - - // Returns the principal of the "top level" document; the origin displayed - // in the URL bar of the browser window. - already_AddRefed GetTopLevelPrincipal(); - - bool ContainsRestrictedContent(); -#endif // MOZ_EME - void CannotDecryptWaitingForKey(); bool MozAutoplayEnabled() const @@ -1474,11 +1447,6 @@ protected: // Timer used for updating progress events. nsCOMPtr mProgressTimer; -#ifdef MOZ_EME - // Encrypted Media Extension media keys. - RefPtr mMediaKeys; -#endif - // Stores the time at the start of the current 'played' range. double mCurrentPlayRangeStart; @@ -1632,11 +1600,6 @@ protected: // Listens for waitingForKey events from the owned decoder. MediaEventListener mWaitingForKeyListener; -#ifdef MOZ_EME - // Init Data that needs to be sent in 'encrypted' events in MetadataLoaded(). - EncryptionInfo mPendingEncryptedInitData; -#endif - // True if the media's channel's download has been suspended. Watchable mDownloadSuspendedByCache; diff --git a/dom/media/AbstractMediaDecoder.h b/dom/media/AbstractMediaDecoder.h index c6aa997553..108f7a57f7 100644 --- a/dom/media/AbstractMediaDecoder.h +++ b/dom/media/AbstractMediaDecoder.h @@ -32,9 +32,6 @@ class MediaResource; class ReentrantMonitor; class VideoFrameContainer; class MediaDecoderOwner; -#ifdef MOZ_EME -class CDMProxy; -#endif typedef nsDataHashtable MetadataTags; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 87454a4686..921ec6bfbf 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -388,9 +388,6 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner) , mLogicalPosition(0.0) , mDuration(std::numeric_limits::quiet_NaN()) , mResourceCallback(new ResourceCallback()) -#ifdef MOZ_EME - , mCDMProxyPromise(mCDMProxyPromiseHolder.Ensure(__func__)) -#endif , mIgnoreProgressData(false) , mInfiniteStream(false) , mOwner(aOwner) @@ -475,10 +472,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 @@ -1551,23 +1544,6 @@ MediaDecoder::CanPlayThrough() return GetStatistics().CanPlayThrough(); } -#ifdef MOZ_EME -RefPtr -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 95f211e1c5..d54ba30de5 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -8,10 +8,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" @@ -437,16 +433,6 @@ private: MediaDecoderOwner* GetOwner() const override; -#ifdef MOZ_EME - typedef MozPromise, 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 RequestCDMProxy() const; - - void SetCDMProxy(CDMProxy* aProxy); -#endif - static bool IsOggEnabled(); static bool IsOpusEnabled(); static bool IsWaveEnabled(); @@ -596,11 +582,6 @@ private: RefPtr mResourceCallback; -#ifdef MOZ_EME - MozPromiseHolder mCDMProxyPromiseHolder; - RefPtr 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 9be4be3d0b..50a29d0951 100644 --- a/dom/media/MediaDecoderOwner.h +++ b/dom/media/MediaDecoderOwner.h @@ -141,14 +141,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& aInitData, - const nsAString& aInitDataType) = 0; -#endif }; } // namespace mozilla diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index dd406ed90e..3a3e2ceb82 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 a0f845538e..c85c93d44f 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 b84a76d624..218bddc4ac 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -1238,11 +1238,7 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata) // 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; @@ -1266,9 +1262,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(Move(mPendingSeek), EventVisibility::Suppressed); } @@ -1581,10 +1574,6 @@ ShutdownState::Enter() // dispose of the timer. master->mVideoDecodeSuspendTimer.Reset(); -#ifdef MOZ_EME - master->mCDMProxyPromise.DisconnectIfExists(); -#endif - if (master->IsPlaying()) { master->StopPlayback(); } @@ -2137,13 +2126,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); @@ -3118,25 +3100,6 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError(nsresult aResult) DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__)); } -#ifdef MOZ_EME -void -MediaDecoderStateMachine::OnCDMProxyReady(RefPtr 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 29da56e57d..6391c85740 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -767,13 +767,6 @@ private: // Playback will not start when audio is offloading. bool mAudioOffloading; -#ifdef MOZ_EME - void OnCDMProxyReady(RefPtr aProxy); - void OnCDMProxyNotReady(); - RefPtr mCDMProxy; - MozPromiseRequestHolder mCDMProxyPromise; -#endif - private: // The buffered range. Mirrored from the decoder thread. Mirror mBuffered; diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index a658298e2d..2bdd2621ac 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 } } @@ -592,54 +583,11 @@ MediaFormatReader::InitInternal() return NS_OK; } -#ifdef MOZ_EME -class DispatchKeyNeededEvent : public Runnable { -public: - DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder, - nsTArray& 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 mDecoder; - nsTArray mInitData; - nsString mInitDataType; -}; - -void -MediaFormatReader::SetCDMProxy(CDMProxy* aProxy) -{ - RefPtr proxy = aProxy; - RefPtr self = this; - nsCOMPtr 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 + /* EME stub */ return false; -#endif } RefPtr @@ -746,13 +694,6 @@ MediaFormatReader::OnDemuxerInitDone(nsresult) UniquePtr 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 ccd43f0e6a..4e084f4158 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -19,10 +19,6 @@ namespace mozilla { -#ifdef MOZ_EME -class CDMProxy; -#endif - class MediaFormatReader final : public MediaDecoderReader { typedef TrackInfo::TrackType TrackType; @@ -92,10 +88,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); @@ -587,14 +579,6 @@ private: RefPtr mVideoFrameContainer; layers::ImageContainer* GetImageContainer(); -#ifdef MOZ_EME - RefPtr mCDMProxy; -#endif - -#ifdef MOZ_GMP - RefPtr mCrashHelper; -#endif - void SetBlankDecode(TrackType aTrack, bool aIsBlankDecode); class DecoderFactory; diff --git a/dom/media/MediaPrefs.h b/dom/media/MediaPrefs.h index 675518ba62..40d0971d80 100644 --- a/dom/media/MediaPrefs.h +++ b/dom/media/MediaPrefs.h @@ -101,9 +101,6 @@ private: #ifdef MOZ_GMP DECL_MEDIA_PREF("media.gmp.insecure.allow", GMPAllowInsecure, bool, false); DECL_MEDIA_PREF("media.gmp.async-shutdown-timeout", GMPAsyncShutdownTimeout, uint32_t, GMP_DEFAULT_ASYNC_SHUTDOWN_TIMEOUT); -#endif -#ifdef MOZ_EME - DECL_MEDIA_PREF("media.eme.enabled", EMEEnabled, bool, false); #endif DECL_MEDIA_PREF("media.use-blank-decoder", PDMUseBlankDecoder, bool, false); DECL_MEDIA_PREF("media.gpu-process-decoder", PDMUseGPUDecoder, bool, false); diff --git a/dom/media/fmp4/MP4Decoder.cpp b/dom/media/fmp4/MP4Decoder.cpp index 3cfe5b1374..ed212992c0 100644 --- a/dom/media/fmp4/MP4Decoder.cpp +++ b/dom/media/fmp4/MP4Decoder.cpp @@ -9,9 +9,6 @@ #include "MP4Demuxer.h" #include "mozilla/Preferences.h" #include "nsCharSeparatedTokenizer.h" -#ifdef MOZ_EME -#include "mozilla/CDMProxy.h" -#endif #include "mozilla/Logging.h" #include "mozilla/SharedThreadPool.h" #include "nsMimeTypes.h" diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index fa6f2f4c83..0bf9d44036 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -22,9 +22,6 @@ #include "GMPUtils.h" #include "prio.h" #include "base/task.h" -#ifdef MOZ_EME -#include "widevine-adapter/WidevineAdapter.h" -#endif using namespace mozilla::ipc; @@ -256,13 +253,7 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter) return false; } -#ifdef MOZ_EME - bool isWidevine = aAdapter.EqualsLiteral("widevine"); - - GMPAdapter* adapter = (isWidevine) ? new WidevineAdapter() : nullptr; -#else GMPAdapter* adapter = nullptr; -#endif if (!mGMPLoader->Load(libPath.get(), libPath.Length(), mNodeId.BeginWriting(), diff --git a/dom/media/gmp/GMPDecryptorParent.cpp b/dom/media/gmp/GMPDecryptorParent.cpp index 56474e9736..410868c33b 100644 --- a/dom/media/gmp/GMPDecryptorParent.cpp +++ b/dom/media/gmp/GMPDecryptorParent.cpp @@ -45,13 +45,7 @@ GMPDecryptorParent::~GMPDecryptorParent() bool GMPDecryptorParent::RecvSetDecryptorId(const uint32_t& aId) { -#ifdef MOZ_EME - if (!mIsOpen) { - NS_WARNING("Trying to use a dead GMP decrypter!"); - return false; - } - mCallback->SetDecryptorId(aId); -#endif + /* EME stub */ return true; } diff --git a/dom/media/gmp/GMPDecryptorProxy.h b/dom/media/gmp/GMPDecryptorProxy.h index ed16755f89..f9e34a45fd 100644 --- a/dom/media/gmp/GMPDecryptorProxy.h +++ b/dom/media/gmp/GMPDecryptorProxy.h @@ -6,9 +6,6 @@ #ifndef GMPDecryptorProxy_h_ #define GMPDecryptorProxy_h_ -#ifdef MOZ_EME -#include "mozilla/DecryptorProxyCallback.h" -#endif #include "GMPCallbackBase.h" #include "gmp-decryption.h" #include "nsString.h" @@ -17,12 +14,7 @@ namespace mozilla { class CryptoSample; } // namespace mozilla -#ifdef MOZ_EME -class GMPDecryptorProxyCallback : public DecryptorProxyCallback, - public GMPCallbackBase { -#else class GMPDecryptorProxyCallback : public GMPCallbackBase { -#endif public: virtual ~GMPDecryptorProxyCallback() {} diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index e6f7972649..c4a7a84a09 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -28,11 +28,6 @@ using mozilla::ipc::GeckoChildProcessHost; #include "WMFDecoderModule.h" #endif -#ifdef MOZ_EME -#include "mozilla/dom/WidevineCDMManifestBinding.h" -#include "widevine-adapter/WidevineAdapter.h" -#endif - namespace mozilla { #undef LOG @@ -654,18 +649,7 @@ GMPParent::ReadGMPMetaData() return ReadGMPInfoFile(infoFile); } -#ifdef MOZ_EME - // Maybe this is the Widevine adapted plugin? - nsCOMPtr manifestFile; - rv = mDirectory->Clone(getter_AddRefs(manifestFile)); - if (NS_FAILED(rv)) { - return GenericPromise::CreateAndReject(rv, __func__); - } - manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json")); - return ReadChromiumManifestFile(manifestFile); -#else return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); -#endif } RefPtr @@ -758,48 +742,8 @@ GMPParent::ReadChromiumManifestFile(nsIFile* aFile) RefPtr GMPParent::ParseChromiumManifest(nsString aJSON) { -#ifdef MOZ_EME - LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get()); - - MOZ_ASSERT(NS_IsMainThread()); - mozilla::dom::WidevineCDMManifest m; - if (!m.Init(aJSON)) { - return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); - } - - nsresult ignored; // Note: ToInteger returns 0 on failure. - if (!WidevineAdapter::Supports(m.mX_cdm_module_versions.ToInteger(&ignored), - m.mX_cdm_interface_versions.ToInteger(&ignored), - m.mX_cdm_host_versions.ToInteger(&ignored))) { - return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); - } - - mDisplayName = NS_ConvertUTF16toUTF8(m.mName); - mDescription = NS_ConvertUTF16toUTF8(m.mDescription); - mVersion = NS_ConvertUTF16toUTF8(m.mVersion); - - GMPCapability video(NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER)); - video.mAPITags.AppendElement(NS_LITERAL_CSTRING("h264")); - video.mAPITags.AppendElement(NS_LITERAL_CSTRING("vp8")); - video.mAPITags.AppendElement(NS_LITERAL_CSTRING("vp9")); - video.mAPITags.AppendElement(kEMEKeySystemWidevine); - mCapabilities.AppendElement(Move(video)); - - GMPCapability decrypt(NS_LITERAL_CSTRING(GMP_API_DECRYPTOR)); - decrypt.mAPITags.AppendElement(kEMEKeySystemWidevine); - mCapabilities.AppendElement(Move(decrypt)); - - MOZ_ASSERT(mName.EqualsLiteral("widevinecdm")); - mAdapter = NS_LITERAL_STRING("widevine"); -#ifdef XP_WIN - mLibs = NS_LITERAL_CSTRING("dxva2.dll"); -#endif - - return GenericPromise::CreateAndResolve(true, __func__); -#else // !MOZ_EME MOZ_ASSERT_UNREACHABLE("don't call me if EME isn't enabled"); return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); -#endif // !MOZ_EME } bool diff --git a/dom/media/gmp/moz.build b/dom/media/gmp/moz.build index c4da2573fb..82d091168d 100644 --- a/dom/media/gmp/moz.build +++ b/dom/media/gmp/moz.build @@ -70,12 +70,6 @@ EXPORTS += [ 'GMPVideoPlaneImpl.h', ] -if CONFIG['MOZ_EME']: - EXPORTS += [ - 'GMPCDMCallbackProxy.h', - 'GMPCDMProxy.h', - ] - UNIFIED_SOURCES += [ 'GMPAudioDecoderChild.cpp', 'GMPAudioDecoderParent.cpp', @@ -111,17 +105,8 @@ UNIFIED_SOURCES += [ 'GMPVideoPlaneImpl.cpp', ] -if CONFIG['MOZ_EME']: - UNIFIED_SOURCES += [ - 'GMPCDMCallbackProxy.cpp', - 'GMPCDMProxy.cpp', - ] - DIRS += ['rlz'] -if CONFIG['MOZ_EME']: - DIRS += ['widevine-adapter'] - IPDL_SOURCES += [ 'GMPTypes.ipdlh', 'PGMP.ipdl', diff --git a/dom/media/gtest/MockMediaDecoderOwner.h b/dom/media/gtest/MockMediaDecoderOwner.h index 1009ca30a1..64d7290187 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& 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/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index 022bb5bd10..907ee40e8f 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -58,34 +58,6 @@ AppendStateToStr(SourceBufferAttributes::AppendState aState) static Atomic sStreamSourceID(0u); -#ifdef MOZ_EME -class DispatchKeyNeededEvent : public Runnable { -public: - DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder, - nsTArray& 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 mDecoder; - nsTArray mInitData; - nsString mInitDataType; -}; -#endif // MOZ_EME - TrackBuffersManager::TrackBuffersManager(MediaSourceDecoder* aParentDecoder, const nsACString& aType) : mInputBuffer(new MediaByteBuffer) @@ -1101,14 +1073,6 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult) UniquePtr crypto = mInputDemuxer->GetCrypto(); if (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(mParentDecoder, crypto->mInitDatas[i].mInitData, - crypto->mInitDatas[i].mType)); - } -#endif info.mCrypto = *crypto; // We clear our crypto init data array, so the MediaFormatReader will // not emit an encrypted event for the same init data again. diff --git a/dom/media/moz.build b/dom/media/moz.build index ef018d4a75..ca3cdac1ca 100644 --- a/dom/media/moz.build +++ b/dom/media/moz.build @@ -44,9 +44,6 @@ if CONFIG['MOZ_FMP4']: if CONFIG['MOZ_WEBRTC']: DIRS += ['bridge'] -if CONFIG['MOZ_EME']: - DIRS += ['eme'] - if CONFIG['MOZ_GMP']: DIRS += [ 'gmp', diff --git a/dom/media/platforms/PDMFactory.cpp b/dom/media/platforms/PDMFactory.cpp index 029b88cecb..389b151994 100644 --- a/dom/media/platforms/PDMFactory.cpp +++ b/dom/media/platforms/PDMFactory.cpp @@ -35,11 +35,6 @@ #include "AgnosticDecoderModule.h" -#ifdef MOZ_EME -#include "mozilla/CDMProxy.h" -#include "EMEDecoderModule.h" -#endif - #include "DecoderDoctorDiagnostics.h" #include "MP4Decoder.h" @@ -444,13 +439,4 @@ PDMFactory::GetDecoder(const TrackInfo& aTrackInfo, return pdm.forget(); } -#ifdef MOZ_EME -void -PDMFactory::SetCDMProxy(CDMProxy* aProxy) -{ - RefPtr m = new PDMFactory(); - mEMEPDM = new EMEDecoderModule(aProxy, m); -} -#endif - } // namespace mozilla diff --git a/dom/media/platforms/PDMFactory.h b/dom/media/platforms/PDMFactory.h index 186c05ca4e..e288efadd0 100644 --- a/dom/media/platforms/PDMFactory.h +++ b/dom/media/platforms/PDMFactory.h @@ -10,10 +10,6 @@ #include "mozilla/Function.h" #include "mozilla/StaticMutex.h" -#ifdef MOZ_EME -class CDMProxy; -#endif - namespace mozilla { class DecoderDoctorDiagnostics; @@ -39,15 +35,6 @@ public: bool Supports(const TrackInfo& aTrackInfo, DecoderDoctorDiagnostics* aDiagnostics) const; -#ifdef MOZ_EME - // Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or - // decrypt-and-decode EME encrypted content. If the CDM only decrypts and - // does not decode, we create a PDM and use that to create MediaDataDecoders - // that we use on on aTaskQueue to decode the decrypted stream. - // This is called on the decode task queue. - void SetCDMProxy(CDMProxy* aProxy); -#endif - static const int kYUV400 = 0; static const int kYUV420 = 1; static const int kYUV422 = 2; diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h index f2abe4b7f7..63b4e00d5c 100644 --- a/dom/media/platforms/PlatformDecoderModule.h +++ b/dom/media/platforms/PlatformDecoderModule.h @@ -39,9 +39,6 @@ class RemoteDecoderModule; class MediaDataDecoder; class MediaDataDecoderCallback; class TaskQueue; -#ifdef MOZ_EME -class CDMProxy; -#endif static LazyLogModule sPDMLog("PlatformDecoderModule"); diff --git a/dom/media/platforms/moz.build b/dom/media/platforms/moz.build index 09d9afa4d2..d4dc579b19 100644 --- a/dom/media/platforms/moz.build +++ b/dom/media/platforms/moz.build @@ -32,9 +32,6 @@ DIRS += [ 'omx' ] -if CONFIG['MOZ_EME']: - DIRS += ['agnostic/eme'] - if CONFIG['MOZ_GMP']: DIRS += ['agnostic/gmp'] diff --git a/dom/media/webaudio/AudioContext.cpp b/dom/media/webaudio/AudioContext.cpp index 44285735be..9539133a4f 100755 --- a/dom/media/webaudio/AudioContext.cpp +++ b/dom/media/webaudio/AudioContext.cpp @@ -372,13 +372,6 @@ AudioContext::CreateMediaElementSource(HTMLMediaElement& aMediaElement, return nullptr; } -#ifdef MOZ_EME - if (aMediaElement.ContainsRestrictedContent()) { - aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR); - return nullptr; - } -#endif - if (CheckClosed(aRv)) { return nullptr; } diff --git a/dom/webidl/HTMLMediaElement.webidl b/dom/webidl/HTMLMediaElement.webidl index ad31f38cbc..7f0f9f8571 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 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"] diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl index 5f2ac63e1e..c91d262c0c 100644 --- a/dom/webidl/Navigator.webidl +++ b/dom/webidl/Navigator.webidl @@ -304,15 +304,6 @@ partial interface Navigator { readonly attribute LegacyMozTCPSocket mozTCPSocket; }; -#ifdef MOZ_EME -partial interface Navigator { - [Pref="media.eme.apiVisible", NewObject] - Promise - requestMediaKeySystemAccess(DOMString keySystem, - sequence supportedConfigurations); -}; -#endif - [NoInterfaceObject, Exposed=(Window,Worker)] interface NavigatorConcurrentHardware { readonly attribute unsigned long long hardwareConcurrency; -- cgit v1.2.3