From e9261d329b443e588de408ff85917ac29d4ab62d Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sat, 16 Mar 2019 13:54:20 +0100 Subject: Fix build bustage. --- dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp | 19 +++++++++++++++++-- dom/media/gmp/widevine-adapter/WidevineUtils.h | 4 ++++ 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'dom/media/gmp/widevine-adapter') diff --git a/dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp b/dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp index f89888a72..4d3408804 100644 --- a/dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp +++ b/dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp @@ -102,7 +102,7 @@ WidevineDecryptor::CreateSession(uint32_t aCreateSessionToken, } else { // Invalid init data type const char* errorMsg = "Invalid init data type when creating session."; - OnRejectPromise(aPromiseId, kNotSupportedError, 0, errorMsg, sizeof(errorMsg)); + OnRejectPromise(aPromiseId, kExceptionNotSupportedError, 0, errorMsg, sizeof(errorMsg)); return; } mPromiseIdToNewSessionTokens[aPromiseId] = aCreateSessionToken; @@ -338,6 +338,21 @@ WidevineDecryptor::OnResolvePromise(uint32_t aPromiseId) mCallback->ResolvePromise(aPromiseId); } +static GMPDOMException +ConvertCDMExceptionToGMPDOMException(cdm::Exception aException) +{ + switch (aException) { + case kExceptionNotSupportedError: return kGMPNotSupportedError; + case kExceptionInvalidStateError: return kGMPInvalidStateError; + case kExceptionTypeError: return kGMPTypeError; + case kExceptionQuotaExceededError: return kGMPQuotaExceededError; + case kUnknownError: return kGMPInvalidModificationError; // Note: Unique placeholder. + case kClientError: return kGMPAbortError; // Note: Unique placeholder. + case kOutputError: return kGMPSecurityError; // Note: Unique placeholder. + }; + return kGMPInvalidStateError; // Note: Unique placeholder. +} + // Align with spec, the Exceptions used by CDM to reject promises . // https://w3c.github.io/encrypted-media/#exceptions cdm::Exception @@ -376,7 +391,7 @@ WidevineDecryptor::OnRejectPromise(uint32_t aPromiseId, Log("Decryptor::OnRejectPromise(aPromiseId=%d, err=%d, sysCode=%u, msg=%s)", aPromiseId, (int)aException, aSystemCode, aErrorMessage); mCallback->RejectPromise(aPromiseId, - ToGMPDOMException(aException), + ConvertCDMExceptionToGMPDOMException(aException), !aErrorMessageSize ? "" : aErrorMessage, aErrorMessageSize); } diff --git a/dom/media/gmp/widevine-adapter/WidevineUtils.h b/dom/media/gmp/widevine-adapter/WidevineUtils.h index ca65ff881..2f6137fe3 100644 --- a/dom/media/gmp/widevine-adapter/WidevineUtils.h +++ b/dom/media/gmp/widevine-adapter/WidevineUtils.h @@ -51,6 +51,10 @@ public: explicit CDMWrapper(cdm::ContentDecryptionModule_9* aCDM, WidevineDecryptor* aDecryptor); cdm::ContentDecryptionModule_9* GetCDM() const { return mCDM; } + void OnStorageId(uint32_t aVersion, const uint8_t* aStorageId, + uint32_t aStorageIdSize) { + mCDM->OnStorageId(aVersion, aStorageId, aStorageIdSize); + } private: ~CDMWrapper(); cdm::ContentDecryptionModule_9* mCDM; -- cgit v1.2.3