Revert following changes for fixing Primetime issue:

- Issue #26 Part 2a: make more EME code conditional. (99118e38e)
- Issue #26 - Part 2b: Stub out GMPDecryptorProxy functions. (d44c61bf6)
- Issue #26 - Part 2c: Remove dependence on gmp/widevine-adapter/* (4c9689f68)
- Issue #1392 - Change --enable-eme to MOZ_ARG_ENABLE_BOOL and remove MOZ_EME_MODULES (832d84d2c)
- [Basilisk] Issue MoonchildProductions/UXP#1392 - Remove usage of MOZ_EME_MODULES (3a165cd)
- Issue #65 - Remove AppConstants from toolkit/mozapps/extensions (758618b60)
This commit is contained in:
Roy Tam 2020-02-29 23:36:29 +08:00
commit 03b286c4d8
29 changed files with 64 additions and 199 deletions

View file

@ -45,6 +45,9 @@ if CONFIG['OS_ARCH'] == 'WINNT':
RCINCLUDE = 'splash.rc' RCINCLUDE = 'splash.rc'
DEFINES['MOZ_PHOENIX'] = True DEFINES['MOZ_PHOENIX'] = True
for cdm in CONFIG['MOZ_EME_MODULES']:
DEFINES['MOZ_%s_EME' % cdm.upper()] = True
# Control the default heap size. # Control the default heap size.
# This is the heap returned by GetProcessHeap(). # This is the heap returned by GetProcessHeap().
# As we use the CRT heap, the default size is too large and wastes VM. # As we use the CRT heap, the default size is too large and wastes VM.

View file

@ -170,7 +170,7 @@ pref("lightweightThemes.update.enabled", true);
pref("lightweightThemes.getMoreURL", "http://@AM_DOMAIN@/personas/"); pref("lightweightThemes.getMoreURL", "http://@AM_DOMAIN@/personas/");
pref("lightweightThemes.recommendedThemes", "[{\"id\":\"recommended-1\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/a-web-browser-renaissance/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/1.header.jpg\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/1.footer.jpg\",\"textcolor\":\"#000000\",\"accentcolor\":\"#f2d9b1\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/1.icon.jpg\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/1.preview.jpg\",\"author\":\"Sean.Martell\",\"version\":\"0\"},{\"id\":\"recommended-2\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/space-fantasy/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/2.header.jpg\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/2.footer.jpg\",\"textcolor\":\"#ffffff\",\"accentcolor\":\"#d9d9d9\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/2.icon.jpg\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/2.preview.jpg\",\"author\":\"fx5800p\",\"version\":\"1.0\"},{\"id\":\"recommended-3\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/linen-light/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/3.header.png\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/3.footer.png\",\"accentcolor\":\"#ada8a8\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/3.icon.png\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/3.preview.png\",\"author\":\"DVemer\",\"version\":\"1.0\"},{\"id\":\"recommended-4\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/pastel-gradient/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/4.header.png\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/4.footer.png\",\"textcolor\":\"#000000\",\"accentcolor\":\"#000000\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/4.icon.png\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/4.preview.png\",\"author\":\"darrinhenein\",\"version\":\"1.0\"},{\"id\":\"recommended-5\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/carbon-light/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/5.header.png\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/5.footer.png\",\"textcolor\":\"#3b3b3b\",\"accentcolor\":\"#2e2e2e\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/5.icon.jpg\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/5.preview.jpg\",\"author\":\"Jaxivo\",\"version\":\"1.0\"}]"); pref("lightweightThemes.recommendedThemes", "[{\"id\":\"recommended-1\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/a-web-browser-renaissance/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/1.header.jpg\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/1.footer.jpg\",\"textcolor\":\"#000000\",\"accentcolor\":\"#f2d9b1\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/1.icon.jpg\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/1.preview.jpg\",\"author\":\"Sean.Martell\",\"version\":\"0\"},{\"id\":\"recommended-2\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/space-fantasy/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/2.header.jpg\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/2.footer.jpg\",\"textcolor\":\"#ffffff\",\"accentcolor\":\"#d9d9d9\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/2.icon.jpg\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/2.preview.jpg\",\"author\":\"fx5800p\",\"version\":\"1.0\"},{\"id\":\"recommended-3\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/linen-light/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/3.header.png\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/3.footer.png\",\"accentcolor\":\"#ada8a8\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/3.icon.png\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/3.preview.png\",\"author\":\"DVemer\",\"version\":\"1.0\"},{\"id\":\"recommended-4\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/pastel-gradient/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/4.header.png\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/4.footer.png\",\"textcolor\":\"#000000\",\"accentcolor\":\"#000000\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/4.icon.png\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/4.preview.png\",\"author\":\"darrinhenein\",\"version\":\"1.0\"},{\"id\":\"recommended-5\",\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/carbon-light/\",\"headerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/5.header.png\",\"footerURL\":\"resource:///chrome/browser/content/browser/defaultthemes/5.footer.png\",\"textcolor\":\"#3b3b3b\",\"accentcolor\":\"#2e2e2e\",\"iconURL\":\"resource:///chrome/browser/content/browser/defaultthemes/5.icon.jpg\",\"previewURL\":\"resource:///chrome/browser/content/browser/defaultthemes/5.preview.jpg\",\"author\":\"Jaxivo\",\"version\":\"1.0\"}]");
#ifdef MOZ_EME #if defined(MOZ_WIDEVINE_EME) || defined(MOZ_ADOBE_EME)
pref("browser.eme.ui.enabled", true); pref("browser.eme.ui.enabled", true);
#else #else
pref("browser.eme.ui.enabled", false); pref("browser.eme.ui.enabled", false);
@ -1178,7 +1178,6 @@ pref("media.gmp.decoder.h264", 2);
// decode H.264. // decode H.264.
pref("media.gmp.trial-create.enabled", true); pref("media.gmp.trial-create.enabled", true);
#ifdef MOZ_EME
// Note: when media.gmp-*.visible is true, provided we're running on a // Note: when media.gmp-*.visible is true, provided we're running on a
// supported platform/OS version, the corresponding CDM appears in the // supported platform/OS version, the corresponding CDM appears in the
// plugins list, Firefox will download the GMP/CDM if enabled, and our // plugins list, Firefox will download the GMP/CDM if enabled, and our
@ -1187,13 +1186,16 @@ pref("media.gmp.trial-create.enabled", true);
// to enable the CDM if its disabled; it's as if the keysystem is completely // to enable the CDM if its disabled; it's as if the keysystem is completely
// unsupported. // unsupported.
#ifdef MOZ_ADOBE_EME
pref("media.gmp-eme-adobe.visible", true); pref("media.gmp-eme-adobe.visible", true);
// When Adobe EME is enabled in the build system, we don't actually enable // When Adobe EME is enabled in the build system, we don't actually enable
// the plugin by default, so that it doesn't download and install by default. // the plugin by default, so that it doesn't download and install by default.
// When Adobe EME is first used, Firefox will prompt the user to enable it, // When Adobe EME is first used, Firefox will prompt the user to enable it,
// and then download the CDM. // and then download the CDM.
pref("media.gmp-eme-adobe.enabled", false); pref("media.gmp-eme-adobe.enabled", false);
#endif
#ifdef MOZ_WIDEVINE_EME
pref("media.gmp-widevinecdm.visible", true); pref("media.gmp-widevinecdm.visible", true);
pref("media.gmp-widevinecdm.enabled", true); pref("media.gmp-widevinecdm.enabled", true);
#endif #endif

View file

@ -1871,20 +1871,6 @@ nsresult HTMLMediaElement::LoadResource()
// Set the media element's CORS mode only when loading a resource // Set the media element's CORS mode only when loading a resource
mCORSMode = AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin)); 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); HTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc);
if (other && other->mDecoder) { if (other && other->mDecoder) {
// Clone it. // Clone it.
@ -4014,6 +4000,7 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
} }
#endif
MediaEventSource<void>* waitingForKeyProducer = mDecoder->WaitingForKeyEvent(); MediaEventSource<void>* waitingForKeyProducer = mDecoder->WaitingForKeyEvent();
// Not every decoder will produce waitingForKey events, only add ones that can // Not every decoder will produce waitingForKey events, only add ones that can
@ -4021,7 +4008,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
mWaitingForKeyListener = waitingForKeyProducer->Connect( mWaitingForKeyListener = waitingForKeyProducer->Connect(
AbstractThread::MainThread(), this, &HTMLMediaElement::CannotDecryptWaitingForKey); AbstractThread::MainThread(), this, &HTMLMediaElement::CannotDecryptWaitingForKey);
} }
#endif
if (mChannelLoader) { if (mChannelLoader) {
mChannelLoader->Done(); mChannelLoader->Done();
@ -6490,6 +6476,7 @@ HTMLMediaElement::GetTopLevelPrincipal()
principal = doc->NodePrincipal(); principal = doc->NodePrincipal();
return principal.forget(); return principal.forget();
} }
#endif //MOZ_EME
void void
HTMLMediaElement::CannotDecryptWaitingForKey() HTMLMediaElement::CannotDecryptWaitingForKey()
@ -6508,7 +6495,6 @@ HTMLMediaElement::CannotDecryptWaitingForKey()
UpdateReadyStateInternal(); UpdateReadyStateInternal();
} }
} }
#endif //MOZ_EME
NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged(bool aCapture) NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged(bool aCapture)
{ {

View file

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

View file

@ -387,9 +387,7 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
, mLogicalPosition(0.0) , mLogicalPosition(0.0)
, mDuration(std::numeric_limits<double>::quiet_NaN()) , mDuration(std::numeric_limits<double>::quiet_NaN())
, mResourceCallback(new ResourceCallback()) , mResourceCallback(new ResourceCallback())
#ifdef MOZ_EME
, mCDMProxyPromise(mCDMProxyPromiseHolder.Ensure(__func__)) , mCDMProxyPromise(mCDMProxyPromiseHolder.Ensure(__func__))
#endif
, mIgnoreProgressData(false) , mIgnoreProgressData(false)
, mInfiniteStream(false) , mInfiniteStream(false)
, mOwner(aOwner) , mOwner(aOwner)
@ -474,9 +472,7 @@ MediaDecoder::Shutdown()
mResourceCallback->Disconnect(); mResourceCallback->Disconnect();
#ifdef MOZ_EME
mCDMProxyPromiseHolder.RejectIfExists(true, __func__); mCDMProxyPromiseHolder.RejectIfExists(true, __func__);
#endif
DiscardOngoingSeekIfExists(); DiscardOngoingSeekIfExists();
@ -1541,7 +1537,6 @@ MediaDecoder::CanPlayThrough()
return GetStatistics().CanPlayThrough(); return GetStatistics().CanPlayThrough();
} }
#ifdef MOZ_EME
RefPtr<MediaDecoder::CDMProxyPromise> RefPtr<MediaDecoder::CDMProxyPromise>
MediaDecoder::RequestCDMProxy() const MediaDecoder::RequestCDMProxy() const
{ {
@ -1556,7 +1551,6 @@ MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__); mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__);
} }
#endif
bool bool
MediaDecoder::IsOpusEnabled() MediaDecoder::IsOpusEnabled()

View file

@ -8,11 +8,7 @@
#define MediaDecoder_h_ #define MediaDecoder_h_
#include "mozilla/Atomics.h" #include "mozilla/Atomics.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h" #include "mozilla/CDMProxy.h"
#endif
#include "mozilla/MozPromise.h" #include "mozilla/MozPromise.h"
#include "mozilla/ReentrantMonitor.h" #include "mozilla/ReentrantMonitor.h"
#include "mozilla/StateMirroring.h" #include "mozilla/StateMirroring.h"
@ -436,7 +432,6 @@ private:
MediaDecoderOwner* GetOwner() const override; MediaDecoderOwner* GetOwner() const override;
#ifdef MOZ_EME
typedef MozPromise<RefPtr<CDMProxy>, bool /* aIgnored */, /* IsExclusive = */ true> CDMProxyPromise; typedef MozPromise<RefPtr<CDMProxy>, bool /* aIgnored */, /* IsExclusive = */ true> CDMProxyPromise;
// Resolved when a CDMProxy is available and the capabilities are known or // Resolved when a CDMProxy is available and the capabilities are known or
@ -444,7 +439,6 @@ private:
RefPtr<CDMProxyPromise> RequestCDMProxy() const; RefPtr<CDMProxyPromise> RequestCDMProxy() const;
void SetCDMProxy(CDMProxy* aProxy); void SetCDMProxy(CDMProxy* aProxy);
#endif
static bool IsOggEnabled(); static bool IsOggEnabled();
static bool IsOpusEnabled(); static bool IsOpusEnabled();
@ -595,10 +589,8 @@ private:
RefPtr<ResourceCallback> mResourceCallback; RefPtr<ResourceCallback> mResourceCallback;
#ifdef MOZ_EME
MozPromiseHolder<CDMProxyPromise> mCDMProxyPromiseHolder; MozPromiseHolder<CDMProxyPromise> mCDMProxyPromiseHolder;
RefPtr<CDMProxyPromise> mCDMProxyPromise; RefPtr<CDMProxyPromise> mCDMProxyPromise;
#endif
protected: protected:
// The promise resolving/rejection is queued as a "micro-task" which will be // The promise resolving/rejection is queued as a "micro-task" which will be

View file

@ -24,9 +24,7 @@
namespace mozilla { namespace mozilla {
#ifdef MOZ_EME
class CDMProxy; class CDMProxy;
#endif
class MediaDecoderReader; class MediaDecoderReader;
struct WaitForDataRejectValue struct WaitForDataRejectValue
@ -188,9 +186,7 @@ public:
// when to call SetIdle(). // when to call SetIdle().
virtual void SetIdle() {} virtual void SetIdle() {}
#ifdef MOZ_EME
virtual void SetCDMProxy(CDMProxy* aProxy) {} virtual void SetCDMProxy(CDMProxy* aProxy) {}
#endif
// Tell the reader that the data decoded are not for direct playback, so it // 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 // can accept more files, in particular those which have more channels than

View file

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

View file

@ -1238,12 +1238,7 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata)
// feeding in the CDM, which we need to decode the first frame (and // 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 // thus get the metadata). We could fix this if we could compute the start
// time by demuxing without necessaring decoding. // time by demuxing without necessaring decoding.
bool waitingForCDM = bool waitingForCDM = Info().IsEncrypted() && !mMaster->mCDMProxy;
#ifdef MOZ_EME
mMaster->Info().IsEncrypted() && !mMaster->mCDMProxy;
#else
false;
#endif
mMaster->mNotifyMetadataBeforeFirstFrame = mMaster->mNotifyMetadataBeforeFirstFrame =
mMaster->mDuration.Ref().isSome() || waitingForCDM; mMaster->mDuration.Ref().isSome() || waitingForCDM;
@ -1267,9 +1262,7 @@ DormantState::HandlePlayStateChanged(MediaDecoder::PlayState aPlayState)
{ {
if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) { if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) {
// Exit dormant when the user wants to play. // Exit dormant when the user wants to play.
#ifdef MOZ_EME
MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy); MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy);
#endif
MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent); MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent);
SetState<SeekingState>(Move(mPendingSeek), EventVisibility::Suppressed); SetState<SeekingState>(Move(mPendingSeek), EventVisibility::Suppressed);
} }
@ -1582,9 +1575,7 @@ ShutdownState::Enter()
// dispose of the timer. // dispose of the timer.
master->mVideoDecodeSuspendTimer.Reset(); master->mVideoDecodeSuspendTimer.Reset();
#ifdef MOZ_EME
master->mCDMProxyPromise.DisconnectIfExists(); master->mCDMProxyPromise.DisconnectIfExists();
#endif
if (master->IsPlaying()) { if (master->IsPlaying()) {
master->StopPlayback(); master->StopPlayback();
@ -2138,12 +2129,10 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
mMediaSink = CreateMediaSink(mAudioCaptured); mMediaSink = CreateMediaSink(mAudioCaptured);
#ifdef MOZ_EME
mCDMProxyPromise.Begin(aDecoder->RequestCDMProxy()->Then( mCDMProxyPromise.Begin(aDecoder->RequestCDMProxy()->Then(
OwnerThread(), __func__, this, OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnCDMProxyReady, &MediaDecoderStateMachine::OnCDMProxyReady,
&MediaDecoderStateMachine::OnCDMProxyNotReady)); &MediaDecoderStateMachine::OnCDMProxyNotReady));
#endif
nsresult rv = mReader->Init(); nsresult rv = mReader->Init();
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -3119,7 +3108,6 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError(nsresult aResult)
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__)); DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__));
} }
#ifdef MOZ_EME
void void
MediaDecoderStateMachine::OnCDMProxyReady(RefPtr<CDMProxy> aProxy) MediaDecoderStateMachine::OnCDMProxyReady(RefPtr<CDMProxy> aProxy)
{ {
@ -3136,7 +3124,6 @@ MediaDecoderStateMachine::OnCDMProxyNotReady()
MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(OnTaskQueue());
mCDMProxyPromise.Complete(); mCDMProxyPromise.Complete();
} }
#endif
void void
MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured) MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured)

View file

@ -768,12 +768,10 @@ private:
// Playback will not start when audio is offloading. // Playback will not start when audio is offloading.
bool mAudioOffloading; bool mAudioOffloading;
#ifdef MOZ_EME
void OnCDMProxyReady(RefPtr<CDMProxy> aProxy); void OnCDMProxyReady(RefPtr<CDMProxy> aProxy);
void OnCDMProxyNotReady(); void OnCDMProxyNotReady();
RefPtr<CDMProxy> mCDMProxy; RefPtr<CDMProxy> mCDMProxy;
MozPromiseRequestHolder<MediaDecoder::CDMProxyPromise> mCDMProxyPromise; MozPromiseRequestHolder<MediaDecoder::CDMProxyPromise> mCDMProxyPromise;
#endif
private: private:
// The buffered range. Mirrored from the decoder thread. // The buffered range. Mirrored from the decoder thread.

View file

@ -4,10 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h" #include "mozilla/CDMProxy.h"
#endif
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
@ -614,6 +611,7 @@ private:
nsTArray<uint8_t> mInitData; nsTArray<uint8_t> mInitData;
nsString mInitDataType; nsString mInitDataType;
}; };
#endif
void void
MediaFormatReader::SetCDMProxy(CDMProxy* aProxy) MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
@ -626,7 +624,6 @@ MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
}); });
OwnerThread()->Dispatch(r.forget()); OwnerThread()->Dispatch(r.forget());
} }
#endif // MOZ_EME
bool bool
MediaFormatReader::IsWaitingOnCDMResource() { MediaFormatReader::IsWaitingOnCDMResource() {

View file

@ -20,9 +20,7 @@
namespace mozilla { namespace mozilla {
#ifdef MOZ_EME
class CDMProxy; class CDMProxy;
#endif
class MediaFormatReader final : public MediaDecoderReader class MediaFormatReader final : public MediaDecoderReader
{ {
@ -93,9 +91,7 @@ public:
return mTrackDemuxersMayBlock; return mTrackDemuxersMayBlock;
} }
#ifdef MOZ_EME
void SetCDMProxy(CDMProxy* aProxy) override; void SetCDMProxy(CDMProxy* aProxy) override;
#endif
// Returns a string describing the state of the decoder data. // Returns a string describing the state of the decoder data.
// Used for debugging purposes. // Used for debugging purposes.
@ -588,9 +584,7 @@ private:
RefPtr<VideoFrameContainer> mVideoFrameContainer; RefPtr<VideoFrameContainer> mVideoFrameContainer;
layers::ImageContainer* GetImageContainer(); layers::ImageContainer* GetImageContainer();
#ifdef MOZ_EME
RefPtr<CDMProxy> mCDMProxy; RefPtr<CDMProxy> mCDMProxy;
#endif
RefPtr<GMPCrashHelper> mCrashHelper; RefPtr<GMPCrashHelper> mCrashHelper;

View file

@ -10,9 +10,7 @@
#include "MP4Demuxer.h" #include "MP4Demuxer.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsCharSeparatedTokenizer.h" #include "nsCharSeparatedTokenizer.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h" #include "mozilla/CDMProxy.h"
#endif
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
#include "mozilla/SharedThreadPool.h" #include "mozilla/SharedThreadPool.h"
#include "nsMimeTypes.h" #include "nsMimeTypes.h"

View file

@ -22,9 +22,7 @@
#include "GMPUtils.h" #include "GMPUtils.h"
#include "prio.h" #include "prio.h"
#include "base/task.h" #include "base/task.h"
#ifdef MOZ_EME
#include "widevine-adapter/WidevineAdapter.h" #include "widevine-adapter/WidevineAdapter.h"
#endif
using namespace mozilla::ipc; using namespace mozilla::ipc;
@ -256,13 +254,9 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter)
return false; return false;
} }
#ifdef MOZ_EME
bool isWidevine = aAdapter.EqualsLiteral("widevine"); bool isWidevine = aAdapter.EqualsLiteral("widevine");
GMPAdapter* adapter = (isWidevine) ? new WidevineAdapter() : nullptr; GMPAdapter* adapter = (isWidevine) ? new WidevineAdapter() : nullptr;
#else
GMPAdapter* adapter = nullptr;
#endif
if (!mGMPLoader->Load(libPath.get(), if (!mGMPLoader->Load(libPath.get(),
libPath.Length(), libPath.Length(),
mNodeId.BeginWriting(), mNodeId.BeginWriting(),

View file

@ -43,13 +43,11 @@ GMPDecryptorParent::~GMPDecryptorParent()
bool bool
GMPDecryptorParent::RecvSetDecryptorId(const uint32_t& aId) GMPDecryptorParent::RecvSetDecryptorId(const uint32_t& aId)
{ {
#ifdef MOZ_EME
if (!mIsOpen) { if (!mIsOpen) {
NS_WARNING("Trying to use a dead GMP decrypter!"); NS_WARNING("Trying to use a dead GMP decrypter!");
return false; return false;
} }
mCallback->SetDecryptorId(aId); mCallback->SetDecryptorId(aId);
#endif
return true; return true;
} }
@ -204,7 +202,6 @@ bool
GMPDecryptorParent::RecvSetSessionId(const uint32_t& aCreateSessionId, GMPDecryptorParent::RecvSetSessionId(const uint32_t& aCreateSessionId,
const nsCString& aSessionId) const nsCString& aSessionId)
{ {
#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvSetSessionId(token=%u, sessionId='%s')", LOGD(("GMPDecryptorParent[%p]::RecvSetSessionId(token=%u, sessionId='%s')",
this, aCreateSessionId, aSessionId.get())); this, aCreateSessionId, aSessionId.get()));
@ -213,7 +210,6 @@ GMPDecryptorParent::RecvSetSessionId(const uint32_t& aCreateSessionId,
return false; return false;
} }
mCallback->SetSessionId(aCreateSessionId, aSessionId); mCallback->SetSessionId(aCreateSessionId, aSessionId);
#endif
return true; return true;
} }
@ -221,7 +217,6 @@ bool
GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId, GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
const bool& aSuccess) const bool& aSuccess)
{ {
#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvResolveLoadSessionPromise(promiseId=%u)", LOGD(("GMPDecryptorParent[%p]::RecvResolveLoadSessionPromise(promiseId=%u)",
this, aPromiseId)); this, aPromiseId));
@ -230,14 +225,12 @@ GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
return false; return false;
} }
mCallback->ResolveLoadSessionPromise(aPromiseId, aSuccess); mCallback->ResolveLoadSessionPromise(aPromiseId, aSuccess);
#endif
return true; return true;
} }
bool bool
GMPDecryptorParent::RecvResolvePromise(const uint32_t& aPromiseId) GMPDecryptorParent::RecvResolvePromise(const uint32_t& aPromiseId)
{ {
#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvResolvePromise(promiseId=%u)", LOGD(("GMPDecryptorParent[%p]::RecvResolvePromise(promiseId=%u)",
this, aPromiseId)); this, aPromiseId));
@ -246,7 +239,6 @@ GMPDecryptorParent::RecvResolvePromise(const uint32_t& aPromiseId)
return false; return false;
} }
mCallback->ResolvePromise(aPromiseId); mCallback->ResolvePromise(aPromiseId);
#endif
return true; return true;
} }
@ -274,7 +266,6 @@ GMPDecryptorParent::RecvRejectPromise(const uint32_t& aPromiseId,
const GMPDOMException& aException, const GMPDOMException& aException,
const nsCString& aMessage) const nsCString& aMessage)
{ {
#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvRejectPromise(promiseId=%u, exception=%d, msg='%s')", LOGD(("GMPDecryptorParent[%p]::RecvRejectPromise(promiseId=%u, exception=%d, msg='%s')",
this, aPromiseId, aException, aMessage.get())); this, aPromiseId, aException, aMessage.get()));
@ -283,11 +274,10 @@ GMPDecryptorParent::RecvRejectPromise(const uint32_t& aPromiseId,
return false; return false;
} }
mCallback->RejectPromise(aPromiseId, GMPExToNsresult(aException), aMessage); mCallback->RejectPromise(aPromiseId, GMPExToNsresult(aException), aMessage);
#endif
return true; return true;
} }
#ifdef MOZ_EME
static dom::MediaKeyMessageType static dom::MediaKeyMessageType
ToMediaKeyMessageType(GMPSessionMessageType aMessageType) { ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
switch (aMessageType) { switch (aMessageType) {
@ -298,14 +288,12 @@ ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
default: return dom::MediaKeyMessageType::License_request; default: return dom::MediaKeyMessageType::License_request;
}; };
}; };
#endif
bool bool
GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId, GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
const GMPSessionMessageType& aMessageType, const GMPSessionMessageType& aMessageType,
nsTArray<uint8_t>&& aMessage) nsTArray<uint8_t>&& aMessage)
{ {
#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvSessionMessage(sessionId='%s', type=%d, msg='%s')", LOGD(("GMPDecryptorParent[%p]::RecvSessionMessage(sessionId='%s', type=%d, msg='%s')",
this, aSessionId.get(), aMessageType, ToBase64(aMessage).get())); this, aSessionId.get(), aMessageType, ToBase64(aMessage).get()));
@ -314,7 +302,6 @@ GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
return false; return false;
} }
mCallback->SessionMessage(aSessionId, ToMediaKeyMessageType(aMessageType), aMessage); mCallback->SessionMessage(aSessionId, ToMediaKeyMessageType(aMessageType), aMessage);
#endif
return true; return true;
} }
@ -322,7 +309,6 @@ bool
GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId, GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
const double& aExpiryTime) const double& aExpiryTime)
{ {
#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)", LOGD(("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)",
this, aSessionId.get(), aExpiryTime)); this, aSessionId.get(), aExpiryTime));
@ -331,14 +317,12 @@ GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
return false; return false;
} }
mCallback->ExpirationChange(aSessionId, aExpiryTime); mCallback->ExpirationChange(aSessionId, aExpiryTime);
#endif
return true; return true;
} }
bool bool
GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId) GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId)
{ {
#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvSessionClosed(sessionId='%s')", LOGD(("GMPDecryptorParent[%p]::RecvSessionClosed(sessionId='%s')",
this, aSessionId.get())); this, aSessionId.get()));
@ -347,7 +331,6 @@ GMPDecryptorParent::RecvSessionClosed(const nsCString& aSessionId)
return false; return false;
} }
mCallback->SessionClosed(aSessionId); mCallback->SessionClosed(aSessionId);
#endif
return true; return true;
} }
@ -357,7 +340,6 @@ GMPDecryptorParent::RecvSessionError(const nsCString& aSessionId,
const uint32_t& aSystemCode, const uint32_t& aSystemCode,
const nsCString& aMessage) const nsCString& aMessage)
{ {
#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvSessionError(sessionId='%s', exception=%d, sysCode=%d, msg='%s')", LOGD(("GMPDecryptorParent[%p]::RecvSessionError(sessionId='%s', exception=%d, sysCode=%d, msg='%s')",
this, aSessionId.get(), this, aSessionId.get(),
aException, aSystemCode, aMessage.get())); aException, aSystemCode, aMessage.get()));
@ -370,11 +352,9 @@ GMPDecryptorParent::RecvSessionError(const nsCString& aSessionId,
GMPExToNsresult(aException), GMPExToNsresult(aException),
aSystemCode, aSystemCode,
aMessage); aMessage);
#endif
return true; return true;
} }
#ifdef MOZ_EME
static dom::MediaKeyStatus static dom::MediaKeyStatus
ToMediaKeyStatus(GMPMediaKeyStatus aStatus) { ToMediaKeyStatus(GMPMediaKeyStatus aStatus) {
switch (aStatus) { switch (aStatus) {
@ -388,13 +368,11 @@ ToMediaKeyStatus(GMPMediaKeyStatus aStatus) {
default: return dom::MediaKeyStatus::Internal_error; default: return dom::MediaKeyStatus::Internal_error;
} }
} }
#endif
bool bool
GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId, GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
InfallibleTArray<GMPKeyInformation>&& aKeyInfos) InfallibleTArray<GMPKeyInformation>&& aKeyInfos)
{ {
#ifdef MOZ_EME
LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(sessionId='%s', KeyInfos len='%d')", LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(sessionId='%s', KeyInfos len='%d')",
this, aSessionId.get(), aKeyInfos.Length())); this, aSessionId.get(), aKeyInfos.Length()));
@ -414,11 +392,9 @@ GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
} }
mCallback->BatchedKeyStatusChanged(aSessionId, cdmKeyInfos); mCallback->BatchedKeyStatusChanged(aSessionId, cdmKeyInfos);
} }
#endif
return true; return true;
} }
#ifdef MOZ_EME
DecryptStatus DecryptStatus
ToDecryptStatus(GMPErr aError) ToDecryptStatus(GMPErr aError)
{ {
@ -429,14 +405,12 @@ ToDecryptStatus(GMPErr aError)
default: return GenericErr; default: return GenericErr;
} }
} }
#endif
bool bool
GMPDecryptorParent::RecvDecrypted(const uint32_t& aId, GMPDecryptorParent::RecvDecrypted(const uint32_t& aId,
const GMPErr& aErr, const GMPErr& aErr,
InfallibleTArray<uint8_t>&& aBuffer) InfallibleTArray<uint8_t>&& aBuffer)
{ {
#ifdef MOZ_EME
LOGV(("GMPDecryptorParent[%p]::RecvDecrypted(id=%d, err=%d)", LOGV(("GMPDecryptorParent[%p]::RecvDecrypted(id=%d, err=%d)",
this, aId, aErr)); this, aId, aErr));
@ -445,7 +419,6 @@ GMPDecryptorParent::RecvDecrypted(const uint32_t& aId,
return false; return false;
} }
mCallback->Decrypted(aId, ToDecryptStatus(aErr), aBuffer); mCallback->Decrypted(aId, ToDecryptStatus(aErr), aBuffer);
#endif
return true; return true;
} }

View file

@ -6,9 +6,7 @@
#ifndef GMPDecryptorProxy_h_ #ifndef GMPDecryptorProxy_h_
#define GMPDecryptorProxy_h_ #define GMPDecryptorProxy_h_
#ifdef MOZ_EME
#include "mozilla/DecryptorProxyCallback.h" #include "mozilla/DecryptorProxyCallback.h"
#endif
#include "GMPCallbackBase.h" #include "GMPCallbackBase.h"
#include "gmp-decryption.h" #include "gmp-decryption.h"
#include "nsString.h" #include "nsString.h"
@ -17,13 +15,8 @@ namespace mozilla {
class CryptoSample; class CryptoSample;
} // namespace mozilla } // namespace mozilla
#ifdef MOZ_EME
class GMPDecryptorProxyCallback : public DecryptorProxyCallback, class GMPDecryptorProxyCallback : public DecryptorProxyCallback,
public GMPCallbackBase { public GMPCallbackBase {
#else
class GMPDecryptorProxyCallback : public GMPCallbackBase {
#endif
public: public:
virtual ~GMPDecryptorProxyCallback() {} virtual ~GMPDecryptorProxyCallback() {}
}; };

View file

@ -30,10 +30,8 @@ using mozilla::ipc::GeckoChildProcessHost;
#include "WMFDecoderModule.h" #include "WMFDecoderModule.h"
#endif #endif
#ifdef MOZ_EME
#include "mozilla/dom/WidevineCDMManifestBinding.h" #include "mozilla/dom/WidevineCDMManifestBinding.h"
#include "widevine-adapter/WidevineAdapter.h" #include "widevine-adapter/WidevineAdapter.h"
#endif
namespace mozilla { namespace mozilla {
@ -656,7 +654,6 @@ GMPParent::ReadGMPMetaData()
return ReadGMPInfoFile(infoFile); return ReadGMPInfoFile(infoFile);
} }
#ifdef MOZ_EME
// Maybe this is the Widevine adapted plugin? // Maybe this is the Widevine adapted plugin?
nsCOMPtr<nsIFile> manifestFile; nsCOMPtr<nsIFile> manifestFile;
rv = mDirectory->Clone(getter_AddRefs(manifestFile)); rv = mDirectory->Clone(getter_AddRefs(manifestFile));
@ -665,9 +662,6 @@ GMPParent::ReadGMPMetaData()
} }
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json")); manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
return ReadChromiumManifestFile(manifestFile); return ReadChromiumManifestFile(manifestFile);
#else
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
#endif
} }
RefPtr<GenericPromise> RefPtr<GenericPromise>
@ -770,7 +764,6 @@ GMPParent::ReadChromiumManifestFile(nsIFile* aFile)
RefPtr<GenericPromise> RefPtr<GenericPromise>
GMPParent::ParseChromiumManifest(nsString aJSON) GMPParent::ParseChromiumManifest(nsString aJSON)
{ {
#ifdef MOZ_EME
LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get()); LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get());
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -808,10 +801,6 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
#endif #endif
return GenericPromise::CreateAndResolve(true, __func__); 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 bool

View file

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

View file

@ -34,10 +34,8 @@ public:
void DownloadProgressed() override {} void DownloadProgressed() override {}
void UpdateReadyState() override {} void UpdateReadyState() override {}
void FirstFrameLoaded() override {} void FirstFrameLoaded() override {}
#ifdef MOZ_EME
void DispatchEncrypted(const nsTArray<uint8_t>& aInitData, void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
const nsAString& aInitDataType) override {} const nsAString& aInitDataType) override {}
#endif
bool IsActive() const override { return true; } bool IsActive() const override { return true; }
bool IsHidden() const override { return false; } bool IsHidden() const override { return false; }
void DownloadSuspended() override {} void DownloadSuspended() override {}

View file

@ -28,11 +28,6 @@ UNIFIED_SOURCES += [
'TestWebMBuffered.cpp', 'TestWebMBuffered.cpp',
] ]
if CONFIG['MOZ_EME']:
UNIFIED_SOURCES += [
'TestEME.cpp',
]
if CONFIG['MOZ_WEBM_ENCODER']: if CONFIG['MOZ_WEBM_ENCODER']:
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'TestVideoTrackEncoder.cpp', 'TestVideoTrackEncoder.cpp',

View file

@ -84,7 +84,7 @@ private:
nsTArray<uint8_t> mInitData; nsTArray<uint8_t> mInitData;
nsString mInitDataType; nsString mInitDataType;
}; };
#endif // MOZ_EME #endif
TrackBuffersManager::TrackBuffersManager(MediaSourceDecoder* aParentDecoder, TrackBuffersManager::TrackBuffersManager(MediaSourceDecoder* aParentDecoder,
const nsACString& aType) const nsACString& aType)

View file

@ -20,6 +20,7 @@ with Files('GetUserMedia*'):
BUG_COMPONENT = component_av BUG_COMPONENT = component_av
DIRS += [ DIRS += [
'eme',
'encoder', 'encoder',
'flac', 'flac',
'gmp', 'gmp',
@ -48,9 +49,6 @@ if CONFIG['MOZ_FMP4']:
if CONFIG['MOZ_WEBRTC']: if CONFIG['MOZ_WEBRTC']:
DIRS += ['bridge'] DIRS += ['bridge']
if CONFIG['MOZ_EME']:
DIRS += ['eme']
TEST_DIRS += [ TEST_DIRS += [
'gtest', 'gtest',
] ]

View file

@ -24,6 +24,7 @@
#endif #endif
#include "GMPDecoderModule.h" #include "GMPDecoderModule.h"
#include "mozilla/CDMProxy.h"
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/SharedThreadPool.h" #include "mozilla/SharedThreadPool.h"
#include "mozilla/StaticPtr.h" #include "mozilla/StaticPtr.h"
@ -36,11 +37,7 @@
#include "H264Converter.h" #include "H264Converter.h"
#include "AgnosticDecoderModule.h" #include "AgnosticDecoderModule.h"
#ifdef MOZ_EME
#include "mozilla/CDMProxy.h"
#include "EMEDecoderModule.h" #include "EMEDecoderModule.h"
#endif
#include "DecoderDoctorDiagnostics.h" #include "DecoderDoctorDiagnostics.h"
@ -466,13 +463,11 @@ PDMFactory::GetDecoder(const TrackInfo& aTrackInfo,
return pdm.forget(); return pdm.forget();
} }
#ifdef MOZ_EME
void void
PDMFactory::SetCDMProxy(CDMProxy* aProxy) PDMFactory::SetCDMProxy(CDMProxy* aProxy)
{ {
RefPtr<PDMFactory> m = new PDMFactory(); RefPtr<PDMFactory> m = new PDMFactory();
mEMEPDM = new EMEDecoderModule(aProxy, m); mEMEPDM = new EMEDecoderModule(aProxy, m);
} }
#endif
} // namespace mozilla } // namespace mozilla

View file

@ -11,9 +11,7 @@
#include "mozilla/Function.h" #include "mozilla/Function.h"
#include "mozilla/StaticMutex.h" #include "mozilla/StaticMutex.h"
#ifdef MOZ_EME
class CDMProxy; class CDMProxy;
#endif
namespace mozilla { namespace mozilla {
@ -40,14 +38,12 @@ public:
bool Supports(const TrackInfo& aTrackInfo, bool Supports(const TrackInfo& aTrackInfo,
DecoderDoctorDiagnostics* aDiagnostics) const; DecoderDoctorDiagnostics* aDiagnostics) const;
#ifdef MOZ_EME
// Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or // Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or
// decrypt-and-decode EME encrypted content. If the CDM only decrypts and // 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 // does not decode, we create a PDM and use that to create MediaDataDecoders
// that we use on on aTaskQueue to decode the decrypted stream. // that we use on on aTaskQueue to decode the decrypted stream.
// This is called on the decode task queue. // This is called on the decode task queue.
void SetCDMProxy(CDMProxy* aProxy); void SetCDMProxy(CDMProxy* aProxy);
#endif
static constexpr int kYUV400 = 0; static constexpr int kYUV400 = 0;
static constexpr int kYUV420 = 1; static constexpr int kYUV420 = 1;

View file

@ -30,13 +30,11 @@ UNIFIED_SOURCES += [
] ]
DIRS += [ DIRS += [
'agnostic/eme',
'agnostic/gmp', 'agnostic/gmp',
'omx' 'omx'
] ]
if CONFIG['MOZ_EME']:
DIRS += ['agnostic/eme']
if CONFIG['MOZ_WMF']: if CONFIG['MOZ_WMF']:
DIRS += [ 'wmf' ]; DIRS += [ 'wmf' ];

View file

@ -282,7 +282,15 @@ WEBIDL_FILES = [
'MediaDeviceInfo.webidl', 'MediaDeviceInfo.webidl',
'MediaDevices.webidl', 'MediaDevices.webidl',
'MediaElementAudioSourceNode.webidl', 'MediaElementAudioSourceNode.webidl',
'MediaEncryptedEvent.webidl',
'MediaError.webidl', 'MediaError.webidl',
'MediaKeyError.webidl',
'MediaKeyMessageEvent.webidl',
'MediaKeys.webidl',
'MediaKeySession.webidl',
'MediaKeysRequestStatus.webidl',
'MediaKeyStatusMap.webidl',
'MediaKeySystemAccess.webidl',
'MediaList.webidl', 'MediaList.webidl',
'MediaQueryList.webidl', 'MediaQueryList.webidl',
'MediaRecorder.webidl', 'MediaRecorder.webidl',
@ -546,6 +554,7 @@ WEBIDL_FILES = [
'WebKitCSSMatrix.webidl', 'WebKitCSSMatrix.webidl',
'WebSocket.webidl', 'WebSocket.webidl',
'WheelEvent.webidl', 'WheelEvent.webidl',
'WidevineCDMManifest.webidl',
'WifiOptions.webidl', 'WifiOptions.webidl',
'WindowOrWorkerGlobalScope.webidl', 'WindowOrWorkerGlobalScope.webidl',
'WindowRoot.webidl', 'WindowRoot.webidl',
@ -572,19 +581,6 @@ WEBIDL_FILES = [
'XULElement.webidl', '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_WEBEXTENSIONS']: if CONFIG['MOZ_WEBEXTENSIONS']:
WEBIDL_FILES += ['AddonManager.webidl'] WEBIDL_FILES += ['AddonManager.webidl']

View file

@ -2901,12 +2901,25 @@ dnl ========================================================
dnl = EME support dnl = EME support
dnl ======================================================== dnl ========================================================
MOZ_ARG_ENABLE_BOOL(eme, MOZ_ARG_ENABLE_STRING(eme,
[ --enable-eme Enable support for Encrypted Media Extensions ], [ --enable-eme[=widevine] Enable support for Encrypted Media Extensions ],
MOZ_EME=1, MOZ_EME_ARGS=$enableval)
MOZ_EME=)
if test "$MOZ_EME_ARGS"; then
if test "$MOZ_EME_ARGS" = "no"; then
dnl EME explicitly disabled with --disable-eme
MOZ_EME=
elif test "$MOZ_EME_ARGS" = "yes"; then
dnl EME explicitly enabled with --enable-eme
MOZ_EME=1
else
dnl EME explicitly enabled with --enable-eme=<args>
MOZ_EME=1
MOZ_EME_MODULES=`echo $MOZ_EME_ARGS | sed -e 's/,/ /g'`
fi
fi
AC_SUBST_SET(MOZ_EME_MODULES)
if test -n "$MOZ_EME"; then if test -n "$MOZ_EME"; then
if test -z "$MOZ_FMP4"; then if test -z "$MOZ_FMP4"; then
AC_MSG_ERROR([Encrypted Media Extension support requires Fragmented MP4 support]) AC_MSG_ERROR([Encrypted Media Extension support requires Fragmented MP4 support])
@ -2914,8 +2927,6 @@ if test -n "$MOZ_EME"; then
AC_DEFINE(MOZ_EME) AC_DEFINE(MOZ_EME)
fi fi
AC_SUBST(MOZ_EME)
MOZ_LIBVPX_CFLAGS= MOZ_LIBVPX_CFLAGS=
MOZ_LIBVPX_LIBS= MOZ_LIBVPX_LIBS=
@ -5287,6 +5298,7 @@ AC_SUBST(MOZ_VORBIS)
AC_SUBST(MOZ_TREMOR) AC_SUBST(MOZ_TREMOR)
AC_SUBST(MOZ_FFVPX) AC_SUBST(MOZ_FFVPX)
AC_SUBST_LIST(FFVPX_ASFLAGS) AC_SUBST_LIST(FFVPX_ASFLAGS)
AC_SUBST(MOZ_EME)
AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT) AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
AC_SUBST(VPX_USE_YASM) AC_SUBST(VPX_USE_YASM)
AC_SUBST_LIST(VPX_ASFLAGS) AC_SUBST_LIST(VPX_ASFLAGS)

View file

@ -7,15 +7,16 @@
const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu, manager: Cm} = const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu, manager: Cm} =
Components; Components;
this.EXPORTED_SYMBOLS = [ "EME_ADOBE_ID", this.EXPORTED_SYMBOLS = [ "GMP_PLUGIN_IDS",
"GMP_PLUGIN_IDS",
"GMPPrefs", "GMPPrefs",
"GMPUtils", "GMPUtils",
"EME_ADOBE_ID",
"OPEN_H264_ID", "OPEN_H264_ID",
"WIDEVINE_ID" ]; "WIDEVINE_ID" ];
Cu.import("resource://gre/modules/Preferences.jsm"); Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
// GMP IDs // GMP IDs
const OPEN_H264_ID = "gmp-gmpopenh264"; const OPEN_H264_ID = "gmp-gmpopenh264";
@ -72,32 +73,24 @@ this.GMPUtils = {
return true; return true;
} }
if (aPlugin.id == EME_ADOBE_ID) { if (aPlugin.id == EME_ADOBE_ID) {
#if defined(XP_WIN) // Windows XP and later only supported by Adobe EME.
// Windows Vista and later only supported by Adobe EME. return AppConstants.isPlatformAndVersionAtLeast("win", "5");
return true;
#else
return false;
#endif
} else if (aPlugin.id == WIDEVINE_ID) { } else if (aPlugin.id == WIDEVINE_ID) {
#if defined(XP_WIN) || defined(XP_LINUX) || defined(XP_MACOSX)
// The Widevine plugin is available for Windows versions Vista and later, // The Widevine plugin is available for Windows versions Vista and later,
// Mac OSX, and Linux. // Mac OSX, and Linux.
return true; return AppConstants.isPlatformAndVersionAtLeast("win", "6") ||
#else AppConstants.platform == "macosx" ||
return false; AppConstants.platform == "linux";
#endif
} }
return true; return true;
}, },
_is32bitModeMacOS: function() { _is32bitModeMacOS: function() {
#ifdef XP_MACOSX if (AppConstants.platform != "macosx") {
return false;
}
return Services.appinfo.XPCOMABI.split("-")[0] == "x86"; return Services.appinfo.XPCOMABI.split("-")[0] == "x86";
#else
return false;
#endif
}, },
/** /**

View file

@ -29,13 +29,13 @@ EXTRA_PP_COMPONENTS += [
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
'ChromeManifestParser.jsm', 'ChromeManifestParser.jsm',
'DeferredSave.jsm', 'DeferredSave.jsm',
'GMPUtils.jsm',
'LightweightThemeManager.jsm', 'LightweightThemeManager.jsm',
] ]
EXTRA_PP_JS_MODULES += [ EXTRA_PP_JS_MODULES += [
'AddonManager.jsm', 'AddonManager.jsm',
'GMPInstallManager.jsm', 'GMPInstallManager.jsm',
'GMPUtils.jsm',
] ]
# Additional debugging info is exposed in debug builds # Additional debugging info is exposed in debug builds