Bug 1276132 - Remove use of #ifdef MOZ_{KEYSYSTEM}_EME in dom/media code. r=jwwang

Instead of controlling visibility of EME keysystems by build config, do it by
preference. This means keysystems can be turned on easier.


MozReview-Commit-ID: Ky1zrHPubOJ

--HG--
extra : rebase_source : 7d68ad8389afdac8fcfffd2c505f8467107c05a5
This commit is contained in:
Chris Pearce 2016-05-31 11:00:55 +12:00
Родитель 42f36f9788
Коммит 64f7e2a1c9
6 изменённых файлов: 36 добавлений и 68 удалений

Просмотреть файл

@ -278,51 +278,51 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
}
#ifdef MOZ_ADOBE_EME
if (aKeySystem.EqualsLiteral("com.adobe.primetime")) {
if (!Preferences::GetBool("media.gmp-eme-adobe.enabled", false)) {
aOutMessage = NS_LITERAL_CSTRING("Adobe EME disabled");
return MediaKeySystemStatus::Cdm_disabled;
}
if (Preferences::GetBool("media.gmp-eme-adobe.visible", false)) {
if (aKeySystem.EqualsLiteral("com.adobe.primetime")) {
if (!Preferences::GetBool("media.gmp-eme-adobe.enabled", false)) {
aOutMessage = NS_LITERAL_CSTRING("Adobe EME disabled");
return MediaKeySystemStatus::Cdm_disabled;
}
#ifdef XP_WIN
// Win Vista and later only.
if (!IsVistaOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Adobe EME");
return MediaKeySystemStatus::Cdm_not_supported;
}
// Win Vista and later only.
if (!IsVistaOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Adobe EME");
return MediaKeySystemStatus::Cdm_not_supported;
}
#endif
#ifdef XP_MACOSX
if (!nsCocoaFeatures::OnLionOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum MacOSX version (10.7) not met for Adobe EME");
return MediaKeySystemStatus::Cdm_not_supported;
if (!nsCocoaFeatures::OnLionOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum MacOSX version (10.7) not met for Adobe EME");
return MediaKeySystemStatus::Cdm_not_supported;
}
#endif
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
}
#endif
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
}
#endif
#ifdef MOZ_WIDEVINE_EME
if (aKeySystem.EqualsLiteral("com.widevine.alpha")) {
if (Preferences::GetBool("media.gmp-widevinecdm.visible", false)) {
if (aKeySystem.EqualsLiteral("com.widevine.alpha")) {
#ifdef XP_WIN
// Win Vista and later only.
if (!IsVistaOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Widevine EME");
return MediaKeySystemStatus::Cdm_not_supported;
}
// Win Vista and later only.
if (!IsVistaOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum Windows version (Vista) not met for Widevine EME");
return MediaKeySystemStatus::Cdm_not_supported;
}
#endif
#ifdef XP_MACOSX
if (!nsCocoaFeatures::OnLionOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum MacOSX version (10.7) not met for Widevine EME");
return MediaKeySystemStatus::Cdm_not_supported;
}
if (!nsCocoaFeatures::OnLionOrLater()) {
aOutMessage = NS_LITERAL_CSTRING("Minimum MacOSX version (10.7) 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;
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);
}
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
}
#endif
return MediaKeySystemStatus::Cdm_not_supported;
}

Просмотреть файл

@ -4,9 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
for cdm in CONFIG['MOZ_EME_MODULES']:
DEFINES['MOZ_%s_EME' % cdm.upper()] = True
EXPORTS.mozilla.dom += [
'MediaEncryptedEvent.h',
'MediaKeyError.h',

Просмотреть файл

@ -23,9 +23,7 @@
#include "GMPUtils.h"
#include "prio.h"
#include "base/task.h"
#ifdef MOZ_WIDEVINE_EME
#include "widevine-adapter/WidevineAdapter.h"
#endif
using namespace mozilla::ipc;
using mozilla::dom::CrashReporterChild;
@ -376,17 +374,12 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter)
return false;
}
#ifdef MOZ_WIDEVINE_EME
bool isWidevine = aAdapter.EqualsLiteral("widevine");
#endif
#if defined(MOZ_GMP_SANDBOX) && defined(XP_MACOSX)
MacSandboxPluginType pluginType = MacSandboxPluginType_GMPlugin_Default;
#ifdef MOZ_WIDEVINE_EME
if (isWidevine) {
pluginType = MacSandboxPluginType_GMPlugin_EME_Widevine;
pluginType = MacSandboxPluginType_GMPlugin_EME_Widevine;
}
#endif
if (!SetMacSandboxInfo(pluginType)) {
NS_WARNING("Failed to set Mac GMP sandbox info");
delete platformAPI;
@ -394,12 +387,7 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter)
}
#endif
GMPAdapter* adapter = nullptr;
#ifdef MOZ_WIDEVINE_EME
if (isWidevine) {
adapter = new WidevineAdapter();
}
#endif
GMPAdapter* adapter = (isWidevine) ? new WidevineAdapter() : nullptr;
if (!mGMPLoader->Load(libPath.get(),
libPath.Length(),
mNodeId.BeginWriting(),

Просмотреть файл

@ -40,10 +40,8 @@ using CrashReporter::GetIDFromMinidump;
#include "WMFDecoderModule.h"
#endif
#ifdef MOZ_WIDEVINE_EME
#include "mozilla/dom/WidevineCDMManifestBinding.h"
#include "widevine-adapter/WidevineAdapter.h"
#endif
namespace mozilla {
@ -809,7 +807,6 @@ 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));
@ -818,9 +815,6 @@ GMPParent::ReadGMPMetaData()
}
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
return ReadChromiumManifestFile(manifestFile);
#else
return GenericPromise::CreateAndReject(rv, __func__);
#endif
}
RefPtr<GenericPromise>
@ -915,7 +909,6 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFile)
return GenericPromise::CreateAndResolve(true, __func__);
}
#ifdef MOZ_WIDEVINE_EME
RefPtr<GenericPromise>
GMPParent::ReadChromiumManifestFile(nsIFile* aFile)
{
@ -968,7 +961,6 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
return GenericPromise::CreateAndResolve(true, __func__);
}
#endif
bool
GMPParent::CanBeSharedCrossNodeIds() const

Просмотреть файл

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

Просмотреть файл

@ -4,9 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
for cdm in CONFIG['MOZ_EME_MODULES']:
DEFINES['MOZ_%s_EME' % cdm.upper()] = True
XPIDL_MODULE = 'content_geckomediaplugins'
XPIDL_SOURCES += [
@ -120,13 +117,9 @@ UNIFIED_SOURCES += [
DIRS += [
'rlz',
'widevine-adapter',
]
if 'widevine' in CONFIG['MOZ_EME_MODULES']:
DIRS += [
'widevine-adapter',
]
IPDL_SOURCES += [
'GMPTypes.ipdlh',
'PGMP.ipdl',