summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/UXP Coding Style.md6
-rw-r--r--dom/html/HTMLMediaElement.cpp18
-rw-r--r--dom/media/AbstractMediaDecoder.h2
-rw-r--r--dom/media/MediaDecoder.cpp6
-rw-r--r--dom/media/MediaDecoder.h8
-rw-r--r--dom/media/MediaDecoderReader.h4
-rw-r--r--dom/media/MediaDecoderReaderWrapper.h2
-rw-r--r--dom/media/MediaDecoderStateMachine.cpp15
-rw-r--r--dom/media/MediaDecoderStateMachine.h2
-rw-r--r--dom/media/MediaFormatReader.cpp5
-rw-r--r--dom/media/MediaFormatReader.h6
-rw-r--r--dom/media/fmp4/MP4Decoder.cpp2
-rw-r--r--dom/media/gmp/GMPChild.cpp6
-rw-r--r--dom/media/gmp/GMPDecryptorParent.cpp29
-rw-r--r--dom/media/gmp/GMPDecryptorProxy.h7
-rw-r--r--dom/media/gmp/GMPParent.cpp11
-rw-r--r--dom/media/gmp/moz.build24
-rw-r--r--dom/media/gtest/MockMediaDecoderOwner.h2
-rw-r--r--dom/media/gtest/moz.build5
-rw-r--r--dom/media/mediasource/TrackBuffersManager.cpp2
-rw-r--r--dom/media/moz.build4
-rw-r--r--dom/media/platforms/PDMFactory.cpp7
-rw-r--r--dom/media/platforms/PDMFactory.h4
-rw-r--r--dom/media/platforms/moz.build4
-rw-r--r--dom/webidl/moz.build22
-rw-r--r--other-licenses/7zstub/ReleaseD/7zSD.sfx.exebin155136 -> 155136 bytes
-rw-r--r--other-licenses/7zstub/uxp/7zSD.sfxbin156672 -> 156672 bytes
27 files changed, 174 insertions, 29 deletions
diff --git a/docs/UXP Coding Style.md b/docs/UXP Coding Style.md
index 83f59c8b1..75cbc8051 100644
--- a/docs/UXP Coding Style.md
+++ b/docs/UXP Coding Style.md
@@ -11,9 +11,9 @@ Our own managed and maintained code should adhere to this guide where possible o
## General formatting rules
The following formatting rules apply to all code:
- Always use spaces for indentation, never use tabs!
-- Put a space between a keyword and parenthesis, e.g. `if (`.
+- Put a space between a keyword and parenthesis, e.g. `if (`. Do _not_ put a space between a function/type-assignment name and its parenthesis, e.g. `function(somevar)` or `int32_t(somevar)`.
- Put a space between variables and operators, e.g. `a == b`.
-- Put a space after a comma or semicolon in variable lists, e.g. `function (a, b, c)` or `for (i = 1; i < 10; i++)`.
+- Put a space after a comma or semicolon in variable lists, e.g. `function(a, b, c)` or `for (i = 1; i < 10; i++)`.
- Indentation of scopes is 2 spaces.
- Indentation of long lines is variable-aligned or expression-aligned (see "long line wrapping")
- Conditional defines are always placed on column 1. This is also true for nested defines.
@@ -236,4 +236,4 @@ ExMSw4MzQ2MjYwNDksLTE5MDMyNzE5OTYsLTEwMTIwMjc3ODMs
LTE4MzgzODM5MDIsODA5MjEzNTEyLC01Mzg0MjM4MDAsMzgyNj
I3NDYzLDIwODYwMjIwODUsLTE1MjU5MjE2MjIsLTY1OTMzMTA0
MCwtNzQwOTE5MDQ1LDE4Njc1NTQxNDJdfQ==
---> \ No newline at end of file
+-->
diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index f3ef20bfc..bc63eab51 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1871,6 +1871,20 @@ 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.
@@ -4000,7 +4014,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
@@ -4008,6 +4021,7 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
mWaitingForKeyListener = waitingForKeyProducer->Connect(
AbstractThread::MainThread(), this, &HTMLMediaElement::CannotDecryptWaitingForKey);
}
+#endif
if (mChannelLoader) {
mChannelLoader->Done();
@@ -6476,7 +6490,6 @@ HTMLMediaElement::GetTopLevelPrincipal()
principal = doc->NodePrincipal();
return principal.forget();
}
-#endif //MOZ_EME
void
HTMLMediaElement::CannotDecryptWaitingForKey()
@@ -6495,6 +6508,7 @@ HTMLMediaElement::CannotDecryptWaitingForKey()
UpdateReadyStateInternal();
}
}
+#endif //MOZ_EME
NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged(bool aCapture)
{
diff --git a/dom/media/AbstractMediaDecoder.h b/dom/media/AbstractMediaDecoder.h
index a0f04ec98..6babcce17 100644
--- a/dom/media/AbstractMediaDecoder.h
+++ b/dom/media/AbstractMediaDecoder.h
@@ -31,7 +31,9 @@ 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 223c59c3b..0cce91ccb 100644
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -387,7 +387,9 @@ 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)
@@ -472,7 +474,9 @@ MediaDecoder::Shutdown()
mResourceCallback->Disconnect();
+#ifdef MOZ_EME
mCDMProxyPromiseHolder.RejectIfExists(true, __func__);
+#endif
DiscardOngoingSeekIfExists();
@@ -1537,6 +1541,7 @@ MediaDecoder::CanPlayThrough()
return GetStatistics().CanPlayThrough();
}
+#ifdef MOZ_EME
RefPtr<MediaDecoder::CDMProxyPromise>
MediaDecoder::RequestCDMProxy() const
{
@@ -1551,6 +1556,7 @@ MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__);
}
+#endif
bool
MediaDecoder::IsOpusEnabled()
diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h
index 05e88db8b..298552433 100644
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -8,7 +8,11 @@
#define MediaDecoder_h_
#include "mozilla/Atomics.h"
+
+#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
+#endif
+
#include "mozilla/MozPromise.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/StateMirroring.h"
@@ -432,6 +436,7 @@ 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
@@ -439,6 +444,7 @@ private:
RefPtr<CDMProxyPromise> RequestCDMProxy() const;
void SetCDMProxy(CDMProxy* aProxy);
+#endif
static bool IsOggEnabled();
static bool IsOpusEnabled();
@@ -589,8 +595,10 @@ 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
diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h
index 8a6997826..f53c74689 100644
--- a/dom/media/MediaDecoderReader.h
+++ b/dom/media/MediaDecoderReader.h
@@ -24,7 +24,9 @@
namespace mozilla {
+#ifdef MOZ_EME
class CDMProxy;
+#endif
class MediaDecoderReader;
struct WaitForDataRejectValue
@@ -186,7 +188,9 @@ 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
diff --git a/dom/media/MediaDecoderReaderWrapper.h b/dom/media/MediaDecoderReaderWrapper.h
index 92001ca33..1a8d3a68c 100644
--- a/dom/media/MediaDecoderReaderWrapper.h
+++ b/dom/media/MediaDecoderReaderWrapper.h
@@ -113,7 +113,9 @@ public:
return mReader->CanonicalBuffered();
}
+#ifdef MOZ_EME
void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); }
+#endif
void SetVideoBlankDecode(bool aIsBlankDecode);
diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp
index 2ed1956c9..63222c22c 100644
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1238,7 +1238,12 @@ 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 = Info().IsEncrypted() && !mMaster->mCDMProxy;
+ bool waitingForCDM =
+#ifdef MOZ_EME
+ mMaster->Info().IsEncrypted() && !mMaster->mCDMProxy;
+#else
+ false;
+#endif
mMaster->mNotifyMetadataBeforeFirstFrame =
mMaster->mDuration.Ref().isSome() || waitingForCDM;
@@ -1262,7 +1267,9 @@ 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);
}
@@ -1575,7 +1582,9 @@ ShutdownState::Enter()
// dispose of the timer.
master->mVideoDecodeSuspendTimer.Reset();
+#ifdef MOZ_EME
master->mCDMProxyPromise.DisconnectIfExists();
+#endif
if (master->IsPlaying()) {
master->StopPlayback();
@@ -2129,10 +2138,12 @@ 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);
@@ -3108,6 +3119,7 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError(nsresult aResult)
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__));
}
+#ifdef MOZ_EME
void
MediaDecoderStateMachine::OnCDMProxyReady(RefPtr<CDMProxy> aProxy)
{
@@ -3124,6 +3136,7 @@ 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 ff3258ff1..f04f34983 100644
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -768,10 +768,12 @@ 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.
diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp
index 773434710..396f31e37 100644
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -4,7 +4,10 @@
* 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"
@@ -611,7 +614,6 @@ private:
nsTArray<uint8_t> mInitData;
nsString mInitDataType;
};
-#endif
void
MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
@@ -624,6 +626,7 @@ MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
});
OwnerThread()->Dispatch(r.forget());
}
+#endif // MOZ_EME
bool
MediaFormatReader::IsWaitingOnCDMResource() {
diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h
index 4d05ca201..be0b7cd17 100644
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -20,7 +20,9 @@
namespace mozilla {
+#ifdef MOZ_EME
class CDMProxy;
+#endif
class MediaFormatReader final : public MediaDecoderReader
{
@@ -91,7 +93,9 @@ 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.
@@ -584,7 +588,9 @@ private:
RefPtr<VideoFrameContainer> mVideoFrameContainer;
layers::ImageContainer* GetImageContainer();
+#ifdef MOZ_EME
RefPtr<CDMProxy> mCDMProxy;
+#endif
RefPtr<GMPCrashHelper> mCrashHelper;
diff --git a/dom/media/fmp4/MP4Decoder.cpp b/dom/media/fmp4/MP4Decoder.cpp
index b293c251b..bf937241c 100644
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -10,7 +10,9 @@
#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 14b06cc72..fa6f2f4c8 100644
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -22,7 +22,9 @@
#include "GMPUtils.h"
#include "prio.h"
#include "base/task.h"
+#ifdef MOZ_EME
#include "widevine-adapter/WidevineAdapter.h"
+#endif
using namespace mozilla::ipc;
@@ -254,9 +256,13 @@ 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 1f8b9a7a8..4f5402160 100644
--- a/dom/media/gmp/GMPDecryptorParent.cpp
+++ b/dom/media/gmp/GMPDecryptorParent.cpp
@@ -43,11 +43,13 @@ 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
return true;
}
@@ -202,6 +204,7 @@ bool
GMPDecryptorParent::RecvSetSessionId(const uint32_t& aCreateSessionId,
const nsCString& aSessionId)
{
+#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvSetSessionId(token=%u, sessionId='%s')",
this, aCreateSessionId, aSessionId.get()));
@@ -210,6 +213,7 @@ GMPDecryptorParent::RecvSetSessionId(const uint32_t& aCreateSessionId,
return false;
}
mCallback->SetSessionId(aCreateSessionId, aSessionId);
+#endif
return true;
}
@@ -217,6 +221,7 @@ bool
GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
const bool& aSuccess)
{
+#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvResolveLoadSessionPromise(promiseId=%u)",
this, aPromiseId));
@@ -225,12 +230,14 @@ GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
return false;
}
mCallback->ResolveLoadSessionPromise(aPromiseId, aSuccess);
+#endif
return true;
}
bool
GMPDecryptorParent::RecvResolvePromise(const uint32_t& aPromiseId)
{
+#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvResolvePromise(promiseId=%u)",
this, aPromiseId));
@@ -239,6 +246,7 @@ GMPDecryptorParent::RecvResolvePromise(const uint32_t& aPromiseId)
return false;
}
mCallback->ResolvePromise(aPromiseId);
+#endif
return true;
}
@@ -266,6 +274,7 @@ GMPDecryptorParent::RecvRejectPromise(const uint32_t& aPromiseId,
const GMPDOMException& aException,
const nsCString& aMessage)
{
+#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvRejectPromise(promiseId=%u, exception=%d, msg='%s')",
this, aPromiseId, aException, aMessage.get()));
@@ -274,10 +283,11 @@ GMPDecryptorParent::RecvRejectPromise(const uint32_t& aPromiseId,
return false;
}
mCallback->RejectPromise(aPromiseId, GMPExToNsresult(aException), aMessage);
+#endif
return true;
}
-
+#ifdef MOZ_EME
static dom::MediaKeyMessageType
ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
switch (aMessageType) {
@@ -288,12 +298,14 @@ ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
default: return dom::MediaKeyMessageType::License_request;
};
};
+#endif
bool
GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
const GMPSessionMessageType& aMessageType,
nsTArray<uint8_t>&& aMessage)
{
+#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvSessionMessage(sessionId='%s', type=%d, msg='%s')",
this, aSessionId.get(), aMessageType, ToBase64(aMessage).get()));
@@ -302,6 +314,7 @@ GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
return false;
}
mCallback->SessionMessage(aSessionId, ToMediaKeyMessageType(aMessageType), aMessage);
+#endif
return true;
}
@@ -309,6 +322,7 @@ bool
GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
const double& aExpiryTime)
{
+#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)",
this, aSessionId.get(), aExpiryTime));
@@ -317,12 +331,14 @@ GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
return false;
}
mCallback->ExpirationChange(aSessionId, aExpiryTime);
+#endif
return true;
}
bool
GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId)
{
+#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvSessionClosed(sessionId='%s')",
this, aSessionId.get()));
@@ -331,6 +347,7 @@ GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId)
return false;
}
mCallback->SessionClosed(aSessionId);
+#endif
return true;
}
@@ -340,6 +357,7 @@ GMPDecryptorParent::RecvSessionError(const nsCString& aSessionId,
const uint32_t& aSystemCode,
const nsCString& aMessage)
{
+#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvSessionError(sessionId='%s', exception=%d, sysCode=%d, msg='%s')",
this, aSessionId.get(),
aException, aSystemCode, aMessage.get()));
@@ -352,9 +370,11 @@ GMPDecryptorParent::RecvSessionError(const nsCString& aSessionId,
GMPExToNsresult(aException),
aSystemCode,
aMessage);
+#endif
return true;
}
+#ifdef MOZ_EME
static dom::MediaKeyStatus
ToMediaKeyStatus(GMPMediaKeyStatus aStatus) {
switch (aStatus) {
@@ -368,11 +388,13 @@ ToMediaKeyStatus(GMPMediaKeyStatus aStatus) {
default: return dom::MediaKeyStatus::Internal_error;
}
}
+#endif
bool
GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
InfallibleTArray<GMPKeyInformation>&& aKeyInfos)
{
+#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(sessionId='%s', KeyInfos len='%d')",
this, aSessionId.get(), aKeyInfos.Length()));
@@ -392,9 +414,11 @@ GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
}
mCallback->BatchedKeyStatusChanged(aSessionId, cdmKeyInfos);
}
+#endif
return true;
}
+#ifdef MOZ_EME
DecryptStatus
ToDecryptStatus(GMPErr aError)
{
@@ -405,12 +429,14 @@ ToDecryptStatus(GMPErr aError)
default: return GenericErr;
}
}
+#endif
bool
GMPDecryptorParent::RecvDecrypted(const uint32_t& aId,
const GMPErr& aErr,
InfallibleTArray<uint8_t>&& aBuffer)
{
+#ifdef MOZ_EME
LOGV(("GMPDecryptorParent[%p]::RecvDecrypted(id=%d, err=%d)",
this, aId, aErr));
@@ -419,6 +445,7 @@ GMPDecryptorParent::RecvDecrypted(const uint32_t& aId,
return false;
}
mCallback->Decrypted(aId, ToDecryptStatus(aErr), aBuffer);
+#endif
return true;
}
diff --git a/dom/media/gmp/GMPDecryptorProxy.h b/dom/media/gmp/GMPDecryptorProxy.h
index 0ef31fd92..ed16755f8 100644
--- a/dom/media/gmp/GMPDecryptorProxy.h
+++ b/dom/media/gmp/GMPDecryptorProxy.h
@@ -6,7 +6,9 @@
#ifndef GMPDecryptorProxy_h_
#define GMPDecryptorProxy_h_
+#ifdef MOZ_EME
#include "mozilla/DecryptorProxyCallback.h"
+#endif
#include "GMPCallbackBase.h"
#include "gmp-decryption.h"
#include "nsString.h"
@@ -15,8 +17,13 @@ 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 234ed5c05..84603e973 100644
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -30,8 +30,10 @@ using mozilla::ipc::GeckoChildProcessHost;
#include "WMFDecoderModule.h"
#endif
+#ifdef MOZ_EME
#include "mozilla/dom/WidevineCDMManifestBinding.h"
#include "widevine-adapter/WidevineAdapter.h"
+#endif
namespace mozilla {
@@ -654,6 +656,7 @@ GMPParent::ReadGMPMetaData()
return ReadGMPInfoFile(infoFile);
}
+#ifdef MOZ_EME
// Maybe this is the Widevine adapted plugin?
nsCOMPtr<nsIFile> manifestFile;
rv = mDirectory->Clone(getter_AddRefs(manifestFile));
@@ -662,6 +665,9 @@ GMPParent::ReadGMPMetaData()
}
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
return ReadChromiumManifestFile(manifestFile);
+#else
+ return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
+#endif
}
RefPtr<GenericPromise>
@@ -754,6 +760,7 @@ GMPParent::ReadChromiumManifestFile(nsIFile* aFile)
RefPtr<GenericPromise>
GMPParent::ParseChromiumManifest(nsString aJSON)
{
+#ifdef MOZ_EME
LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get());
MOZ_ASSERT(NS_IsMainThread());
@@ -791,6 +798,10 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
#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 3b67fb5c9..79de6e1d9 100644
--- a/dom/media/gmp/moz.build
+++ b/dom/media/gmp/moz.build
@@ -35,8 +35,6 @@ EXPORTS += [
'GMPAudioDecoderProxy.h',
'GMPAudioHost.h',
'GMPCallbackBase.h',
- 'GMPCDMCallbackProxy.h',
- 'GMPCDMProxy.h',
'GMPChild.h',
'GMPContentChild.h',
'GMPContentParent.h',
@@ -73,6 +71,12 @@ 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':
@@ -87,8 +91,6 @@ UNIFIED_SOURCES += [
'GMPAudioDecoderChild.cpp',
'GMPAudioDecoderParent.cpp',
'GMPAudioHost.cpp',
- 'GMPCDMCallbackProxy.cpp',
- 'GMPCDMProxy.cpp',
'GMPChild.cpp',
'GMPContentChild.cpp',
'GMPContentParent.cpp',
@@ -120,10 +122,16 @@ UNIFIED_SOURCES += [
'GMPVideoPlaneImpl.cpp',
]
-DIRS += [
- 'rlz',
- 'widevine-adapter',
-]
+if CONFIG['MOZ_EME']:
+ UNIFIED_SOURCES += [
+ 'GMPCDMCallbackProxy.cpp',
+ 'GMPCDMProxy.cpp',
+ ]
+
+DIRS += ['rlz']
+
+if CONFIG['MOZ_EME']:
+ DIRS += ['widevine-adapter']
IPDL_SOURCES += [
'GMPTypes.ipdlh',
diff --git a/dom/media/gtest/MockMediaDecoderOwner.h b/dom/media/gtest/MockMediaDecoderOwner.h
index 324f18141..1009ca30a 100644
--- a/dom/media/gtest/MockMediaDecoderOwner.h
+++ b/dom/media/gtest/MockMediaDecoderOwner.h
@@ -34,8 +34,10 @@ 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/media/gtest/moz.build b/dom/media/gtest/moz.build
index a7ea73807..ae059962c 100644
--- a/dom/media/gtest/moz.build
+++ b/dom/media/gtest/moz.build
@@ -28,6 +28,11 @@ UNIFIED_SOURCES += [
'TestWebMBuffered.cpp',
]
+if CONFIG['MOZ_EME']:
+ UNIFIED_SOURCES += [
+ 'TestEME.cpp',
+ ]
+
if CONFIG['MOZ_WEBM_ENCODER']:
UNIFIED_SOURCES += [
'TestVideoTrackEncoder.cpp',
diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp
index 21fb158b5..9a2d00ad8 100644
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -84,7 +84,7 @@ private:
nsTArray<uint8_t> mInitData;
nsString mInitDataType;
};
-#endif
+#endif // MOZ_EME
TrackBuffersManager::TrackBuffersManager(MediaSourceDecoder* aParentDecoder,
const nsACString& aType)
diff --git a/dom/media/moz.build b/dom/media/moz.build
index df8cb619d..41267a6ef 100644
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -20,7 +20,6 @@ with Files('GetUserMedia*'):
BUG_COMPONENT = component_av
DIRS += [
- 'eme',
'encoder',
'flac',
'gmp',
@@ -49,6 +48,9 @@ if CONFIG['MOZ_FMP4']:
if CONFIG['MOZ_WEBRTC']:
DIRS += ['bridge']
+if CONFIG['MOZ_EME']:
+ DIRS += ['eme']
+
TEST_DIRS += [
'gtest',
]
diff --git a/dom/media/platforms/PDMFactory.cpp b/dom/media/platforms/PDMFactory.cpp
index 5bfdcffb7..6e7241c46 100644
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -24,7 +24,6 @@
#endif
#include "GMPDecoderModule.h"
-#include "mozilla/CDMProxy.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/SharedThreadPool.h"
#include "mozilla/StaticPtr.h"
@@ -37,7 +36,11 @@
#include "H264Converter.h"
#include "AgnosticDecoderModule.h"
+
+#ifdef MOZ_EME
+#include "mozilla/CDMProxy.h"
#include "EMEDecoderModule.h"
+#endif
#include "DecoderDoctorDiagnostics.h"
@@ -450,11 +453,13 @@ PDMFactory::GetDecoder(const TrackInfo& aTrackInfo,
return pdm.forget();
}
+#ifdef MOZ_EME
void
PDMFactory::SetCDMProxy(CDMProxy* aProxy)
{
RefPtr<PDMFactory> 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 94be7e928..2b43fa1ab 100644
--- a/dom/media/platforms/PDMFactory.h
+++ b/dom/media/platforms/PDMFactory.h
@@ -11,7 +11,9 @@
#include "mozilla/Function.h"
#include "mozilla/StaticMutex.h"
+#ifdef MOZ_EME
class CDMProxy;
+#endif
namespace mozilla {
@@ -38,12 +40,14 @@ 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 constexpr int kYUV400 = 0;
static constexpr int kYUV420 = 1;
diff --git a/dom/media/platforms/moz.build b/dom/media/platforms/moz.build
index f5fb72c5d..c46d52e3f 100644
--- a/dom/media/platforms/moz.build
+++ b/dom/media/platforms/moz.build
@@ -30,11 +30,13 @@ UNIFIED_SOURCES += [
]
DIRS += [
- 'agnostic/eme',
'agnostic/gmp',
'omx'
]
+if CONFIG['MOZ_EME']:
+ DIRS += ['agnostic/eme']
+
if CONFIG['MOZ_WMF']:
DIRS += [ 'wmf' ];
diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build
index 4e3b8f655..4740887f3 100644
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -285,15 +285,7 @@ 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',
@@ -565,7 +557,6 @@ WEBIDL_FILES = [
'WebKitCSSMatrix.webidl',
'WebSocket.webidl',
'WheelEvent.webidl',
- 'WidevineCDMManifest.webidl',
'WifiOptions.webidl',
'WindowOrWorkerGlobalScope.webidl',
'WindowRoot.webidl',
@@ -592,6 +583,19 @@ WEBIDL_FILES = [
'XULElement.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_AUDIO_CHANNEL_MANAGER']:
WEBIDL_FILES += [
'AudioChannelManager.webidl',
diff --git a/other-licenses/7zstub/ReleaseD/7zSD.sfx.exe b/other-licenses/7zstub/ReleaseD/7zSD.sfx.exe
index e1e37cf2e..e5a8b0bbc 100644
--- a/other-licenses/7zstub/ReleaseD/7zSD.sfx.exe
+++ b/other-licenses/7zstub/ReleaseD/7zSD.sfx.exe
Binary files differ
diff --git a/other-licenses/7zstub/uxp/7zSD.sfx b/other-licenses/7zstub/uxp/7zSD.sfx
index bcc8ba606..4dab45978 100644
--- a/other-licenses/7zstub/uxp/7zSD.sfx
+++ b/other-licenses/7zstub/uxp/7zSD.sfx
Binary files differ