Bug 1300654 Part1-Remove MOZ_EME from code base. r=cpearce,smaug

MozReview-Commit-ID: JboGO0w4tcE

--HG--
extra : rebase_source : abfe53f30081f74fc39c900cab48d08c7574bfec
This commit is contained in:
James Cheng 2016-09-08 18:06:20 +08:00
parent 0ad3db41b5
commit 48efb9caad
35 changed files with 42 additions and 207 deletions

View File

@ -899,10 +899,8 @@ bin/libfreebl_32int64_3.so
#endif
; media
#ifdef MOZ_EME
@RESPATH@/gmp-clearkey/0.1/@DLL_PREFIX@clearkey@DLL_SUFFIX@
@RESPATH@/gmp-clearkey/0.1/clearkey.info
#endif
#ifdef PKG_LOCALE_MANIFEST
#include @PKG_LOCALE_MANIFEST@

View File

@ -830,10 +830,8 @@ bin/libfreebl_32int64_3.so
; media
#ifdef MOZ_EME
@RESPATH@/gmp-clearkey/0.1/@DLL_PREFIX@clearkey@DLL_SUFFIX@
@RESPATH@/gmp-clearkey/0.1/clearkey.info
#endif
; gfx
#ifdef XP_WIN

View File

@ -116,10 +116,8 @@
#endif
#include "mozilla/dom/ContentChild.h"
#ifdef MOZ_EME
#include "mozilla/EMEUtils.h"
#include "mozilla/DetailedPromise.h"
#endif
namespace mozilla {
namespace dom {
@ -249,9 +247,7 @@ 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
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDeviceStorageAreaListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPresentation)
#ifdef MOZ_GAMEPAD
@ -386,12 +382,10 @@ Navigator::Invalidate()
mServiceWorkerContainer = nullptr;
#ifdef MOZ_EME
if (mMediaKeySystemAccessManager) {
mMediaKeySystemAccessManager->Shutdown();
mMediaKeySystemAccessManager = nullptr;
}
#endif
if (mDeviceStorageAreaListener) {
mDeviceStorageAreaListener = nullptr;
@ -2324,7 +2318,6 @@ Navigator::GetUserAgent(nsPIDOMWindowInner* aWindow, nsIURI* aURI,
return siteSpecificUA->GetUserAgentForURIAndWindow(aURI, aWindow, aUserAgent);
}
#ifdef MOZ_EME
static nsCString
ToCString(const nsString& aString)
{
@ -2450,7 +2443,6 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
mMediaKeySystemAccessManager->Request(promise, aKeySystem, aConfigs);
return promise.forget();
}
#endif
Presentation*
Navigator::GetPresentation(ErrorResult& aRv)

View File

@ -18,9 +18,7 @@
#include "nsString.h"
#include "nsTArray.h"
#include "nsWeakPtr.h"
#ifdef MOZ_EME
#include "mozilla/dom/MediaKeySystemAccessManager.h"
#endif
class nsPluginArray;
class nsMimeTypeArray;
@ -317,14 +315,12 @@ public:
// any, else null.
static already_AddRefed<nsPIDOMWindowInner> GetWindowFromGlobal(JSObject* aGlobal);
#ifdef MOZ_EME
already_AddRefed<Promise>
RequestMediaKeySystemAccess(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfig,
ErrorResult& aRv);
private:
RefPtr<MediaKeySystemAccessManager> mMediaKeySystemAccessManager;
#endif
public:
void NotifyVRDisplaysUpdated();

View File

@ -4346,7 +4346,6 @@ nsDocument::SetScopeObject(nsIGlobalObject* aGlobal)
}
}
#ifdef MOZ_EME
static void
CheckIfContainsEMEContent(nsISupports* aSupports, void* aContainsEME)
{
@ -4370,7 +4369,6 @@ nsDocument::ContainsEMEContent()
static_cast<void*>(&containsEME));
return containsEME;
}
#endif // MOZ_EME
static void
CheckIfContainsMSEContent(nsISupports* aSupports, void* aContainsMSE)
@ -8375,13 +8373,11 @@ 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.

View File

@ -1275,9 +1275,7 @@ public:
js::ExpandoAndGeneration mExpandoAndGeneration;
#ifdef MOZ_EME
bool ContainsEMEContent();
#endif
bool ContainsMSEContent();

View File

@ -4785,12 +4785,10 @@ 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)) &&

View File

@ -11,9 +11,7 @@
#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"
@ -721,9 +719,7 @@ 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_END
@ -748,9 +744,7 @@ 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_END
@ -928,14 +922,12 @@ void HTMLMediaElement::ShutdownDecoder()
void HTMLMediaElement::AbortExistingLoads()
{
#ifdef MOZ_EME
// If there is no existing decoder then we don't have anything to
// report. This prevents reporting the initial load from an
// empty video element as a failed EME load.
if (mDecoder) {
ReportEMETelemetry();
}
#endif
// Abort any already-running instance of the resource selection algorithm.
mLoadWaitStatus = NOT_WAITING;
@ -994,9 +986,7 @@ void HTMLMediaElement::AbortExistingLoads()
mDownloadSuspendedByCache = false;
mMediaInfo = MediaInfo();
mIsEncrypted = false;
#ifdef MOZ_EME
mPendingEncryptedInitData.mInitDatas.Clear();
#endif // MOZ_EME
mWaitingForKey = false;
mSourcePointer = nullptr;
@ -1637,6 +1627,18 @@ nsresult HTMLMediaElement::LoadResource()
// Set the media element's CORS mode only when loading a resource
mCORSMode = AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
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 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;
}
HTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc);
if (other && other->mDecoder) {
// Clone it.
@ -2535,11 +2537,9 @@ 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()) {
@ -3473,7 +3473,6 @@ void HTMLMediaElement::HiddenVideoStop()
mVideoDecodeSuspendTimer = nullptr;
}
#ifdef MOZ_EME
void
HTMLMediaElement::ReportEMETelemetry()
{
@ -3485,7 +3484,6 @@ HTMLMediaElement::ReportEMETelemetry()
this, mLoadedDataFired ? "true" : "false"));
}
}
#endif
void
HTMLMediaElement::ReportTelemetry()
@ -3842,7 +3840,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
ms.mFinishWhenEnded);
}
#ifdef MOZ_EME
if (mMediaKeys) {
if (mMediaKeys->GetCDMProxy()) {
mDecoder->SetCDMProxy(mMediaKeys->GetCDMProxy());
@ -3852,7 +3849,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
return NS_ERROR_FAILURE;
}
}
#endif
MediaEventSource<void>* waitingForKeyProducer = mDecoder->WaitingForKeyEvent();
// Not every decoder will produce waitingForKey events, only add ones that can
@ -4315,11 +4311,7 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
SetMediaInfo(*aInfo);
mIsEncrypted = aInfo->IsEncrypted()
#ifdef MOZ_EME
|| mPendingEncryptedInitData.IsEncrypted()
#endif // MOZ_EME
;
mIsEncrypted = aInfo->IsEncrypted() || mPendingEncryptedInitData.IsEncrypted();
mTags = aTags.forget();
mLoadedDataFired = false;
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
@ -4345,13 +4337,11 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
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 // MOZ_EME
}
mWatchManager.ManualNotify(&HTMLMediaElement::UpdateReadyStateInternal);
@ -5270,11 +5260,8 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
UpdateAudioChannelPlayingState();
if (aPauseElement) {
ReportTelemetry();
#ifdef MOZ_EME
ReportEMETelemetry();
#endif
#ifdef MOZ_EME
// For EME content, 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
@ -5287,16 +5274,13 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
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()) {
@ -6079,7 +6063,7 @@ HTMLMediaElement::OnVisibilityChange(Visibility aNewVisibility)
}
}
#ifdef MOZ_EME
MediaKeys*
HTMLMediaElement::GetMediaKeys() const
{
@ -6285,7 +6269,6 @@ HTMLMediaElement::GetTopLevelPrincipal()
principal = doc->NodePrincipal();
return principal.forget();
}
#endif // MOZ_EME
void
HTMLMediaElement::CannotDecryptWaitingForKey()

View File

@ -20,9 +20,7 @@
#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"
@ -626,7 +624,6 @@ public:
// XPCOM MozPreservesPitch() is OK
#ifdef MOZ_EME
MediaKeys* GetMediaKeys() const;
already_AddRefed<Promise> SetMediaKeys(MediaKeys* mediaKeys,
@ -648,7 +645,6 @@ public:
already_AddRefed<nsIPrincipal> GetTopLevelPrincipal();
bool ContainsRestrictedContent();
#endif // MOZ_EME
void CannotDecryptWaitingForKey();
@ -1191,9 +1187,8 @@ protected:
*/
void HiddenVideoStop();
#ifdef MOZ_EME
void ReportEMETelemetry();
#endif
void ReportTelemetry();
// Check the permissions for audiochannel.
@ -1452,10 +1447,8 @@ protected:
// Timer used to simulate video-suspend.
nsCOMPtr<nsITimer> mVideoDecodeSuspendTimer;
#ifdef MOZ_EME
// Encrypted Media Extension media keys.
RefPtr<MediaKeys> mMediaKeys;
#endif
// Stores the time at the start of the current 'played' range.
double mCurrentPlayRangeStart;
@ -1604,10 +1597,8 @@ 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 // MOZ_EME
// True if the media's channel's download has been suspended.
Watchable<bool> mDownloadSuspendedByCache;

View File

@ -46,9 +46,7 @@
#include "mozilla/dom/ExternalHelperAppParent.h"
#include "mozilla/dom/GetFilesHelper.h"
#include "mozilla/dom/GeolocationBinding.h"
#ifdef MOZ_EME
#include "mozilla/dom/MediaKeySystemAccess.h"
#endif
#include "mozilla/dom/Notification.h"
#include "mozilla/dom/PContentBridgeParent.h"
#include "mozilla/dom/PContentPermissionRequestParent.h"
@ -975,14 +973,9 @@ ContentParent::RecvIsGMPPresentOnDisk(const nsString& aKeySystem,
bool* aIsPresent,
nsCString* aMessage)
{
#ifdef MOZ_EME
*aIsPresent = MediaKeySystemAccess::IsGMPPresentOnDisk(aKeySystem,
aVersion,
*aMessage);
#else
*aIsPresent = false;
#endif
return true;
}

View File

@ -30,9 +30,7 @@ class MediaResource;
class ReentrantMonitor;
class VideoFrameContainer;
class MediaDecoderOwner;
#ifdef MOZ_EME
class CDMProxy;
#endif
typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;

View File

@ -311,13 +311,10 @@ MediaDecoder::IsHeuristicDormantSupported() const
{
MOZ_ASSERT(NS_IsMainThread());
return
#if defined(MOZ_EME)
// We disallow dormant for encrypted media until bug 1181864 is fixed.
mInfo &&
!mInfo->IsEncrypted() &&
#endif
mIsHeuristicDormantSupported;
// We disallow dormant for encrypted media until bug 1181864 is fixed.
return mInfo &&
!mInfo->IsEncrypted() &&
mIsHeuristicDormantSupported;
}
void
@ -494,9 +491,7 @@ 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)
@ -592,9 +587,7 @@ MediaDecoder::Shutdown()
mResourceCallback->Disconnect();
#ifdef MOZ_EME
mCDMProxyPromiseHolder.RejectIfExists(true, __func__);
#endif
DiscardOngoingSeekIfExists();
@ -1707,7 +1700,6 @@ MediaDecoder::CanPlayThrough()
return GetStatistics().CanPlayThrough();
}
#ifdef MOZ_EME
RefPtr<MediaDecoder::CDMProxyPromise>
MediaDecoder::RequestCDMProxy() const
{
@ -1722,7 +1714,6 @@ MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__);
}
#endif
bool
MediaDecoder::IsOpusEnabled()

View File

@ -7,11 +7,8 @@
#if !defined(MediaDecoder_h_)
#define MediaDecoder_h_
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
#include "mozilla/Atomics.h"
#include "mozilla/CDMProxy.h"
#include "mozilla/MozPromise.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/StateMirroring.h"
@ -444,7 +441,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
@ -452,7 +448,6 @@ private:
RefPtr<CDMProxyPromise> RequestCDMProxy() const;
void SetCDMProxy(CDMProxy* aProxy);
#endif
void EnsureTelemetryReported();
@ -620,10 +615,8 @@ 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

View File

@ -143,13 +143,11 @@ public:
// 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 // MOZ_EME
};
} // namespace mozilla

View File

@ -186,9 +186,7 @@ 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

View File

@ -116,9 +116,7 @@ public:
return mReader->CanonicalIsSuspended();
}
#ifdef MOZ_EME
void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); }
#endif
void SetVideoBlankDecode(bool aIsBlankDecode);

View File

@ -317,12 +317,7 @@ private:
// 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->mInfo.IsEncrypted() && !mMaster->mCDMProxy;
#else
false;
#endif
bool waitingForCDM = mMaster->mInfo.IsEncrypted() && !mMaster->mCDMProxy;
mMaster->mNotifyMetadataBeforeFirstFrame =
mMaster->mDuration.Ref().isSome() || waitingForCDM;
@ -1346,12 +1341,10 @@ 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);
@ -1678,9 +1671,7 @@ MediaDecoderStateMachine::Shutdown()
// dispose of the timer.
mVideoDecodeSuspendTimer.Reset();
#ifdef MOZ_EME
mCDMProxyPromise.DisconnectIfExists();
#endif
if (IsPlaying()) {
StopPlayback();
@ -2907,7 +2898,6 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError(nsresult aResult)
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__));
}
#ifdef MOZ_EME
void
MediaDecoderStateMachine::OnCDMProxyReady(RefPtr<CDMProxy> aProxy)
{
@ -2924,7 +2914,6 @@ MediaDecoderStateMachine::OnCDMProxyNotReady()
MOZ_ASSERT(OnTaskQueue());
mCDMProxyPromise.Complete();
}
#endif
void
MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured)

View File

@ -873,12 +873,10 @@ 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.

View File

@ -4,6 +4,7 @@
* 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/. */
#include "mozilla/CDMProxy.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
@ -21,10 +22,6 @@
#include <algorithm>
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#endif
using namespace mozilla::media;
using mozilla::layers::Image;
@ -186,7 +183,6 @@ MediaFormatReader::Init()
return NS_OK;
}
#ifdef MOZ_EME
class DispatchKeyNeededEvent : public Runnable {
public:
DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder,
@ -224,16 +220,11 @@ MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
});
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>
@ -341,13 +332,11 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
mIsEncrypted = crypto && crypto->IsEncrypted();
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 // MOZ_EME
mInfo.mCrypto = *crypto;
}
@ -397,12 +386,8 @@ MediaFormatReader::EnsureDecoderCreated(TrackType aTrack)
if (!mPlatform) {
mPlatform = new PDMFactory();
if (IsEncrypted()) {
#ifdef MOZ_EME
MOZ_ASSERT(mCDMProxy);
mPlatform->SetCDMProxy(mCDMProxy);
#else
return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, "EME not supported");
#endif
}
}

View File

@ -93,9 +93,7 @@ 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.
@ -569,9 +567,8 @@ private:
RefPtr<VideoFrameContainer> mVideoFrameContainer;
layers::ImageContainer* GetImageContainer();
#ifdef MOZ_EME
RefPtr<CDMProxy> mCDMProxy;
#endif
RefPtr<GMPCrashHelper> mCrashHelper;
void SetBlankDecode(TrackType aTrack, bool aIsBlankDecode);

View File

@ -9,9 +9,7 @@
#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"

View File

@ -41,10 +41,8 @@ using CrashReporter::GetIDFromMinidump;
#include "WMFDecoderModule.h"
#endif
#ifdef MOZ_EME
#include "mozilla/dom/WidevineCDMManifestBinding.h"
#include "widevine-adapter/WidevineAdapter.h"
#endif
namespace mozilla {
@ -810,7 +808,6 @@ GMPParent::ReadGMPMetaData()
return ReadGMPInfoFile(infoFile);
}
#ifdef MOZ_EME
// Maybe this is the Widevine adapted plugin?
nsCOMPtr<nsIFile> manifestFile;
rv = mDirectory->Clone(getter_AddRefs(manifestFile));
@ -819,9 +816,6 @@ GMPParent::ReadGMPMetaData()
}
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
return ReadChromiumManifestFile(manifestFile);
#else
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
#endif
}
RefPtr<GenericPromise>
@ -935,7 +929,6 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get());
MOZ_ASSERT(NS_IsMainThread());
#ifdef MOZ_EME
mozilla::dom::WidevineCDMManifest m;
if (!m.Init(aJSON)) {
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
@ -970,10 +963,6 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
#endif
return GenericPromise::CreateAndResolve(true, __func__);
#else
MOZ_ASSERT_UNREACHABLE("don't call me if EME isn't enabled");
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
#endif
}
bool

View File

@ -35,6 +35,8 @@ EXPORTS += [
'GMPAudioDecoderProxy.h',
'GMPAudioHost.h',
'GMPCallbackBase.h',
'GMPCDMCallbackProxy.h',
'GMPCDMProxy.h',
'GMPChild.h',
'GMPContentChild.h',
'GMPContentParent.h',
@ -71,12 +73,6 @@ EXPORTS += [
'GMPVideoPlaneImpl.h',
]
if CONFIG['MOZ_EME']:
EXPORTS += [
'GMPCDMCallbackProxy.h',
'GMPCDMProxy.h',
]
# We link GMPLoader into xul on B2G/Fennec as its code does not need to be
# covered by a DRM vendor's voucher.
if CONFIG['OS_TARGET'] == 'Android':
@ -91,6 +87,8 @@ UNIFIED_SOURCES += [
'GMPAudioDecoderChild.cpp',
'GMPAudioDecoderParent.cpp',
'GMPAudioHost.cpp',
'GMPCDMCallbackProxy.cpp',
'GMPCDMProxy.cpp',
'GMPChild.cpp',
'GMPContentChild.cpp',
'GMPContentParent.cpp',
@ -122,12 +120,6 @@ UNIFIED_SOURCES += [
'GMPVideoPlaneImpl.cpp',
]
if CONFIG['MOZ_EME']:
UNIFIED_SOURCES += [
'GMPCDMCallbackProxy.cpp',
'GMPCDMProxy.cpp',
]
DIRS += [
'rlz',
'widevine-adapter',

View File

@ -34,10 +34,8 @@ 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 // MOZ_EME
bool IsActive() const override { return true; }
bool IsHidden() const override { return false; }
void DownloadSuspended() override {}

View File

@ -7,6 +7,7 @@
UNIFIED_SOURCES += [
'MockMediaResource.cpp',
'TestAudioCompactor.cpp',
'TestEME.cpp',
'TestGMPCrossOrigin.cpp',
'TestGMPRemoveAndDelete.cpp',
'TestGMPUtils.cpp',
@ -25,11 +26,6 @@ UNIFIED_SOURCES += [
'TestWebMBuffered.cpp',
]
if CONFIG['MOZ_EME']:
UNIFIED_SOURCES += [
'TestEME.cpp',
]
if CONFIG['MOZ_WEBM_ENCODER']:
UNIFIED_SOURCES += [
'TestVideoTrackEncoder.cpp',

View File

@ -58,7 +58,6 @@ AppendStateToStr(SourceBufferAttributes::AppendState aState)
static Atomic<uint32_t> sStreamSourceID(0u);
#ifdef MOZ_EME
class DispatchKeyNeededEvent : public Runnable {
public:
DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder,
@ -84,7 +83,6 @@ private:
nsTArray<uint8_t> mInitData;
nsString mInitDataType;
};
#endif // MOZ_EME
TrackBuffersManager::TrackBuffersManager(MediaSourceDecoder* aParentDecoder,
const nsACString& aType)
@ -1063,14 +1061,12 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
UniquePtr<EncryptionInfo> 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 // MOZ_EME
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.

View File

@ -20,6 +20,7 @@ with Files('GetUserMedia*'):
BUG_COMPONENT = component_av
DIRS += [
'eme',
'encoder',
'flac',
'gmp',
@ -56,9 +57,6 @@ if CONFIG['MOZ_WEBRTC']:
if CONFIG['MOZ_OMX_DECODER']:
DIRS += ['omx']
if CONFIG['MOZ_EME']:
DIRS += ['eme']
TEST_DIRS += [
'compiledtest',
'gtest',

View File

@ -26,6 +26,7 @@
#endif
#include "GMPDecoderModule.h"
#include "mozilla/CDMProxy.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/SharedThreadPool.h"
#include "mozilla/StaticPtr.h"
@ -38,11 +39,7 @@
#include "H264Converter.h"
#include "AgnosticDecoderModule.h"
#ifdef MOZ_EME
#include "EMEDecoderModule.h"
#include "mozilla/CDMProxy.h"
#endif
#include "DecoderDoctorDiagnostics.h"
@ -419,13 +416,11 @@ PDMFactory::GetDecoder(const nsACString& aMimeType,
return pdm.forget();
}
#ifdef MOZ_EME
void
PDMFactory::SetCDMProxy(CDMProxy* aProxy)
{
RefPtr<PDMFactory> m = new PDMFactory();
mEMEPDM = new EMEDecoderModule(aProxy, m);
}
#endif
} // namespace mozilla

View File

@ -36,14 +36,12 @@ public:
bool SupportsMimeType(const nsACString& aMimeType,
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 constexpr int kYUV400 = 0;
static constexpr int kYUV420 = 1;

View File

@ -31,6 +31,7 @@ UNIFIED_SOURCES += [
]
DIRS += [
'agnostic/eme',
'agnostic/gmp',
'omx'
]
@ -38,9 +39,6 @@ DIRS += [
if CONFIG['MOZ_WMF']:
DIRS += [ 'wmf' ];
if CONFIG['MOZ_EME']:
DIRS += ['agnostic/eme']
if CONFIG['MOZ_FFVPX'] or CONFIG['MOZ_FFMPEG']:
# common code to either FFmpeg or FFVPX
UNIFIED_SOURCES += [

View File

@ -354,12 +354,11 @@ AudioContext::CreateMediaElementSource(HTMLMediaElement& aMediaElement,
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
#ifdef MOZ_EME
if (aMediaElement.ContainsRestrictedContent()) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
#endif
if (CheckClosed(aRv)) {
return nullptr;

View File

@ -153,7 +153,6 @@ partial interface HTMLMediaElement {
attribute EventHandler onmozinterruptend;
};
#ifdef MOZ_EME
// Encrypted Media Extensions
partial interface HTMLMediaElement {
[Pref="media.eme.apiVisible"]
@ -169,7 +168,6 @@ partial interface HTMLMediaElement {
[Pref="media.eme.apiVisible"]
attribute EventHandler onwaitingforkey;
};
#endif
// This is just for testing
partial interface HTMLMediaElement {

View File

@ -422,14 +422,12 @@ partial interface Navigator {
readonly attribute LegacyMozTCPSocket mozTCPSocket;
};
#ifdef MOZ_EME
partial interface Navigator {
[Pref="media.eme.apiVisible", NewObject]
Promise<MediaKeySystemAccess>
requestMediaKeySystemAccess(DOMString keySystem,
sequence<MediaKeySystemConfiguration> supportedConfigurations);
};
#endif
#ifdef NIGHTLY_BUILD
partial interface Navigator {

View File

@ -9,7 +9,6 @@ GENERATED_WEBIDL_FILES = [
]
PREPROCESSED_WEBIDL_FILES = [
'HTMLMediaElement.webidl',
'Navigator.webidl',
'Node.webidl',
'Promise.webidl',
@ -225,6 +224,7 @@ WEBIDL_FILES = [
'HTMLLIElement.webidl',
'HTMLLinkElement.webidl',
'HTMLMapElement.webidl',
'HTMLMediaElement.webidl',
'HTMLMenuElement.webidl',
'HTMLMenuItemElement.webidl',
'HTMLMetaElement.webidl',
@ -301,7 +301,15 @@ WEBIDL_FILES = [
'MediaDeviceInfo.webidl',
'MediaDevices.webidl',
'MediaElementAudioSourceNode.webidl',
'MediaEncryptedEvent.webidl',
'MediaError.webidl',
'MediaKeyError.webidl',
'MediaKeyMessageEvent.webidl',
'MediaKeys.webidl',
'MediaKeySession.webidl',
'MediaKeysRequestStatus.webidl',
'MediaKeyStatusMap.webidl',
'MediaKeySystemAccess.webidl',
'MediaList.webidl',
'MediaQueryList.webidl',
'MediaRecorder.webidl',
@ -603,6 +611,7 @@ WEBIDL_FILES = [
'WebKitCSSMatrix.webidl',
'WebSocket.webidl',
'WheelEvent.webidl',
'WidevineCDMManifest.webidl',
'WifiOptions.webidl',
'WindowRoot.webidl',
'Worker.webidl',
@ -899,19 +908,6 @@ if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
'External.webidl',
]
if CONFIG['MOZ_EME']:
WEBIDL_FILES += [
'MediaEncryptedEvent.webidl',
'MediaKeyError.webidl',
'MediaKeyMessageEvent.webidl',
'MediaKeys.webidl',
'MediaKeySession.webidl',
'MediaKeysRequestStatus.webidl',
'MediaKeyStatusMap.webidl',
'MediaKeySystemAccess.webidl',
'WidevineCDMManifest.webidl',
]
if CONFIG['MOZ_B2G']:
WEBIDL_FILES += [
'Apps.webidl',

View File

@ -7502,11 +7502,9 @@ nsLayoutUtils::SurfaceFromElement(HTMLVideoElement* aElement,
(aSurfaceFlags & SFE_PREFER_NO_PREMULTIPLY_ALPHA) == 0,
"We can't support non-premultiplied alpha for video!");
#ifdef MOZ_EME
if (aElement->ContainsRestrictedContent()) {
return result;
}
#endif
uint16_t readyState;
if (NS_SUCCEEDED(aElement->GetReadyState(&readyState)) &&