Bug 1245789 - Use ifdef MOZ_WIDEVINE_EME to prevent compilation when not enabled. r=gerald,a=ritu

This means we won't try to build it when ac_add_options --enable-eme=widevine is
not present, and critically, we won't try to build it on Android, since the Chromium
Widevine plugin isn't available there.

MozReview-Commit-ID: 1jQvAbJP8HG
This commit is contained in:
Chris Pearce 2016-04-12 16:12:21 +12:00
parent 2a0de18a90
commit eb954729f0
5 changed files with 42 additions and 5 deletions

View File

@ -1356,11 +1356,18 @@ pref("media.gmp.decoder.h264", 2);
// decode H.264.
pref("media.gmp.trial-create.enabled", true);
#ifdef MOZ_ADOBE_EME
#if defined(MOZ_ADOBE_EME) || defined(MOZ_WIDEVINE_EME)
pref("browser.eme.ui.enabled", true);
#endif
#ifdef MOZ_ADOBE_EME
pref("media.gmp-eme-adobe.enabled", true);
#endif
#ifdef MOZ_WIDEVINE_EME
pref("media.gmp-widevinecdm.enabled", true);
#endif
// Play with different values of the decay time and get telemetry,
// 0 means to randomize (and persist) the experiment value in users' profiles,
// -1 means no experiment is run and we use the preferred value for frecency (6h)

View File

@ -306,9 +306,22 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
}
#endif
#ifdef MOZ_WIDEVINE_EME
if (aKeySystem.EqualsLiteral("com.widevine.alpha")) {
#ifdef XP_WIN
// Win Vista and later only.
if (!IsVistaOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version not met for Widevine EME");
return MediaKeySystemStatus::Cdm_not_supported;
}
#endif
if (!Preferences::GetBool("media.gmp-widevinecdm.enabled", false)) {
aOutMessage = NS_LITERAL_CSTRING("Widevine EME disabled");
return MediaKeySystemStatus::Cdm_disabled;
}
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
}
#endif
return MediaKeySystemStatus::Cdm_not_supported;
}

View File

@ -21,7 +21,9 @@
#include "mozilla/dom/CrashReporterChild.h"
#include "GMPUtils.h"
#include "prio.h"
#ifdef MOZ_WIDEVINE_EME
#include "widevine-adapter/WidevineAdapter.h"
#endif
using mozilla::dom::CrashReporterChild;
@ -379,8 +381,12 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter)
}
#endif
GMPAdapter* adapter = aAdapter.EqualsLiteral("widevine")
? new WidevineAdapter() : nullptr;
GMPAdapter* adapter = nullptr;
#ifdef MOZ_WIDEVINE_EME
if (aAdapter.EqualsLiteral("widevine")) {
adapter = new WidevineAdapter();
}
#endif
if (!mGMPLoader->Load(libPath.get(),
libPath.Length(),
mNodeId.BeginWriting(),

View File

@ -22,7 +22,6 @@
#include "mozilla/SandboxInfo.h"
#endif
#include "GMPContentParent.h"
#include "widevine-adapter/WidevineAdapter.h"
#include "mozilla/dom/CrashReporterParent.h"
using mozilla::dom::CrashReporterParent;
@ -35,7 +34,11 @@ using CrashReporter::GetIDFromMinidump;
#endif
#include "mozilla/Telemetry.h"
#ifdef MOZ_WIDEVINE_EME
#include "mozilla/dom/WidevineCDMManifestBinding.h"
#include "widevine-adapter/WidevineAdapter.h"
#endif
namespace mozilla {
@ -785,6 +788,7 @@ GMPParent::ReadGMPMetaData()
return ReadGMPInfoFile(infoFile);
}
#ifdef MOZ_WIDEVINE_EME
// Maybe this is the Widevine adapted plugin?
nsCOMPtr<nsIFile> manifestFile;
rv = mDirectory->Clone(getter_AddRefs(manifestFile));
@ -793,6 +797,9 @@ GMPParent::ReadGMPMetaData()
}
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
return ReadChromiumManifestFile(manifestFile);
#else
return InitPromise::CreateAndReject(rv, __func__);
#endif
}
RefPtr<GMPParent::InitPromise>
@ -892,6 +899,7 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFile)
return InitPromise::CreateAndResolve(NS_OK, __func__);
}
#ifdef MOZ_WIDEVINE_EME
RefPtr<GMPParent::InitPromise>
GMPParent::ReadChromiumManifestFile(nsIFile* aFile)
{
@ -949,6 +957,7 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
return InitPromise::CreateAndResolve(NS_OK, __func__);
}
#endif
bool
GMPParent::CanBeSharedCrossNodeIds() const

View File

@ -169,8 +169,10 @@ private:
bool EnsureProcessLoaded();
RefPtr<InitPromise> ReadGMPMetaData();
RefPtr<InitPromise> ReadGMPInfoFile(nsIFile* aFile);
RefPtr<InitPromise> ReadChromiumManifestFile(nsIFile* aFile);
#ifdef MOZ_WIDEVINE_EME
RefPtr<InitPromise> ParseChromiumManifest(nsString aJSON); // Main thread.
RefPtr<InitPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread.
#endif
#ifdef MOZ_CRASHREPORTER
void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes);
void GetCrashID(nsString& aResult);