summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2022-04-21 01:42:56 -0500
committerMatt A. Tobin <email@mattatobin.com>2022-04-21 01:42:56 -0500
commit0c7843d82b2ac8d73c0a6fb69865d086fc1f81b2 (patch)
treef8472f65304d1f23717c913793310d28a6faa2f7 /dom
parent53918edf762b539e2e0ece3bc844931bf2437cb6 (diff)
downloadaura-central-0c7843d82b2ac8d73c0a6fb69865d086fc1f81b2.tar.gz
Issue #25 - Part 12: Remove EME from dom/media/gmp
Diffstat (limited to 'dom')
-rw-r--r--dom/media/gmp/GMPChild.cpp10
-rw-r--r--dom/media/gmp/GMPDecryptorParent.cpp164
-rw-r--r--dom/media/gmp/GMPDecryptorProxy.h9
-rw-r--r--dom/media/gmp/GMPParent.cpp56
4 files changed, 1 insertions, 238 deletions
diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp
index eb1803736..f8c5f0aef 100644
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -22,9 +22,6 @@
#include "GMPUtils.h"
#include "prio.h"
#include "base/task.h"
-#ifdef MOZ_EME
-#include "widevine-adapter/WidevineAdapter.h"
-#endif
using namespace mozilla::ipc;
@@ -254,13 +251,8 @@ 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 56474e973..30bb72c39 100644
--- a/dom/media/gmp/GMPDecryptorParent.cpp
+++ b/dom/media/gmp/GMPDecryptorParent.cpp
@@ -45,13 +45,6 @@ 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;
}
@@ -206,16 +199,6 @@ 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()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->SetSessionId(aCreateSessionId, aSessionId);
-#endif
return true;
}
@@ -223,32 +206,12 @@ bool
GMPDecryptorParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
const bool& aSuccess)
{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvResolveLoadSessionPromise(promiseId=%u)",
- this, aPromiseId));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- 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));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->ResolvePromise(aPromiseId);
-#endif
return true;
}
@@ -276,47 +239,14 @@ 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()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->RejectPromise(aPromiseId, GMPExToNsresult(aException), aMessage);
-#endif
return true;
}
-#ifdef MOZ_EME
-static dom::MediaKeyMessageType
-ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
- switch (aMessageType) {
- case kGMPLicenseRequest: return dom::MediaKeyMessageType::License_request;
- case kGMPLicenseRenewal: return dom::MediaKeyMessageType::License_renewal;
- case kGMPLicenseRelease: return dom::MediaKeyMessageType::License_release;
- case kGMPIndividualizationRequest: return dom::MediaKeyMessageType::Individualization_request;
- 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()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->SessionMessage(aSessionId, ToMediaKeyMessageType(aMessageType), aMessage);
-#endif
return true;
}
@@ -324,32 +254,12 @@ bool
GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
const double& aExpiryTime)
{
-#ifdef MOZ_EME
- LOGD(("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)",
- this, aSessionId.get(), aExpiryTime));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- 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()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->SessionClosed(aSessionId);
-#endif
return true;
}
@@ -359,95 +269,21 @@ 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()));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- return false;
- }
- mCallback->SessionError(aSessionId,
- GMPExToNsresult(aException),
- aSystemCode,
- aMessage);
-#endif
return true;
}
-#ifdef MOZ_EME
-static dom::MediaKeyStatus
-ToMediaKeyStatus(GMPMediaKeyStatus aStatus) {
- switch (aStatus) {
- case kGMPUsable: return dom::MediaKeyStatus::Usable;
- case kGMPExpired: return dom::MediaKeyStatus::Expired;
- case kGMPOutputDownscaled: return dom::MediaKeyStatus::Output_downscaled;
- case kGMPOutputRestricted: return dom::MediaKeyStatus::Output_restricted;
- case kGMPInternalError: return dom::MediaKeyStatus::Internal_error;
- case kGMPReleased: return dom::MediaKeyStatus::Released;
- case kGMPStatusPending: return dom::MediaKeyStatus::Status_pending;
- 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()));
-
- if (mIsOpen) {
- nsTArray<CDMKeyInfo> cdmKeyInfos(aKeyInfos.Length());
- for (uint32_t i = 0; i < aKeyInfos.Length(); i++) {
- LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(keyId=%s, gmp-status=%d)",
- this, ToBase64(aKeyInfos[i].keyId()).get(), aKeyInfos[i].status()));
- // If the status is kGMPUnknown, we're going to forget(remove) that key info.
- if (aKeyInfos[i].status() != kGMPUnknown) {
- auto status = ToMediaKeyStatus(aKeyInfos[i].status());
- cdmKeyInfos.AppendElement(CDMKeyInfo(aKeyInfos[i].keyId(),
- dom::Optional<dom::MediaKeyStatus>(status)));
- } else {
- cdmKeyInfos.AppendElement(CDMKeyInfo(aKeyInfos[i].keyId()));
- }
- }
- mCallback->BatchedKeyStatusChanged(aSessionId, cdmKeyInfos);
- }
-#endif
return true;
}
-#ifdef MOZ_EME
-DecryptStatus
-ToDecryptStatus(GMPErr aError)
-{
- switch (aError) {
- case GMPNoErr: return Ok;
- case GMPNoKeyErr: return NoKeyErr;
- case GMPAbortedErr: return AbortedErr;
- 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));
-
- if (!mIsOpen) {
- NS_WARNING("Trying to use a dead GMP decrypter!");
- 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 ed16755f8..71565c4da 100644
--- a/dom/media/gmp/GMPDecryptorProxy.h
+++ b/dom/media/gmp/GMPDecryptorProxy.h
@@ -6,9 +6,6 @@
#ifndef GMPDecryptorProxy_h_
#define GMPDecryptorProxy_h_
-#ifdef MOZ_EME
-#include "mozilla/DecryptorProxyCallback.h"
-#endif
#include "GMPCallbackBase.h"
#include "gmp-decryption.h"
#include "nsString.h"
@@ -17,13 +14,7 @@ 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 e6f797264..c4a7a84a0 100644
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -28,11 +28,6 @@ using mozilla::ipc::GeckoChildProcessHost;
#include "WMFDecoderModule.h"
#endif
-#ifdef MOZ_EME
-#include "mozilla/dom/WidevineCDMManifestBinding.h"
-#include "widevine-adapter/WidevineAdapter.h"
-#endif
-
namespace mozilla {
#undef LOG
@@ -654,18 +649,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));
- if (NS_FAILED(rv)) {
- return GenericPromise::CreateAndReject(rv, __func__);
- }
- manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
- return ReadChromiumManifestFile(manifestFile);
-#else
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
-#endif
}
RefPtr<GenericPromise>
@@ -758,48 +742,8 @@ 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());
- mozilla::dom::WidevineCDMManifest m;
- if (!m.Init(aJSON)) {
- return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
- }
-
- nsresult ignored; // Note: ToInteger returns 0 on failure.
- if (!WidevineAdapter::Supports(m.mX_cdm_module_versions.ToInteger(&ignored),
- m.mX_cdm_interface_versions.ToInteger(&ignored),
- m.mX_cdm_host_versions.ToInteger(&ignored))) {
- return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
- }
-
- mDisplayName = NS_ConvertUTF16toUTF8(m.mName);
- mDescription = NS_ConvertUTF16toUTF8(m.mDescription);
- mVersion = NS_ConvertUTF16toUTF8(m.mVersion);
-
- GMPCapability video(NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER));
- video.mAPITags.AppendElement(NS_LITERAL_CSTRING("h264"));
- video.mAPITags.AppendElement(NS_LITERAL_CSTRING("vp8"));
- video.mAPITags.AppendElement(NS_LITERAL_CSTRING("vp9"));
- video.mAPITags.AppendElement(kEMEKeySystemWidevine);
- mCapabilities.AppendElement(Move(video));
-
- GMPCapability decrypt(NS_LITERAL_CSTRING(GMP_API_DECRYPTOR));
- decrypt.mAPITags.AppendElement(kEMEKeySystemWidevine);
- mCapabilities.AppendElement(Move(decrypt));
-
- MOZ_ASSERT(mName.EqualsLiteral("widevinecdm"));
- mAdapter = NS_LITERAL_STRING("widevine");
-#ifdef XP_WIN
- mLibs = NS_LITERAL_CSTRING("dxva2.dll");
-#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