summaryrefslogtreecommitdiffstats
path: root/dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2019-02-08 10:35:58 -0600
committertrav90 <travawine@protonmail.ch>2019-02-08 10:35:58 -0600
commit1fa998d8919375312d20d6d54bae955d166031c7 (patch)
treedc27c0e6c7528d6c9691ad90130d9c576c358b17 /dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp
parent4adc4098851a84ed9436162e8114c6f834fbb64c (diff)
downloadUXP-1fa998d8919375312d20d6d54bae955d166031c7.tar
UXP-1fa998d8919375312d20d6d54bae955d166031c7.tar.gz
UXP-1fa998d8919375312d20d6d54bae955d166031c7.tar.lz
UXP-1fa998d8919375312d20d6d54bae955d166031c7.tar.xz
UXP-1fa998d8919375312d20d6d54bae955d166031c7.zip
[EME] Make WidevineAdapter compatible with CDM version 9
NOTE: this breaks compatibility with CDM version 8.
Diffstat (limited to 'dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp')
-rw-r--r--dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp63
1 files changed, 33 insertions, 30 deletions
diff --git a/dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp b/dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp
index 149fa1701..e85aa2db3 100644
--- a/dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp
+++ b/dom/media/gmp/widevine-adapter/WidevineDecryptor.cpp
@@ -302,6 +302,12 @@ WidevineDecryptor::GetCurrentWallTime()
}
void
+ChromiumCDMChild::OnResolveKeyStatusPromise(uint32_t aPromiseId,
+ cdm::KeyStatus aKeyStatus) {
+ //TODO: The callback of GetStatusForPolicy. See Mozilla bug 1404230.
+}
+
+void
WidevineDecryptor::OnResolveNewSessionPromise(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdSize)
@@ -332,42 +338,41 @@ WidevineDecryptor::OnResolvePromise(uint32_t aPromiseId)
mCallback->ResolvePromise(aPromiseId);
}
-static GMPDOMException
-ToGMPDOMException(cdm::Error aError)
-{
- switch (aError) {
- case kNotSupportedError: return kGMPNotSupportedError;
- case kInvalidStateError: return kGMPInvalidStateError;
- case kInvalidAccessError:
- // Note: Chrome converts kInvalidAccessError to TypeError, since the
- // Chromium CDM API doesn't have a type error enum value. The EME spec
- // requires TypeError in some places, so we do the same conversion.
- // See bug 1313202.
- return kGMPTypeError;
- case kQuotaExceededError: return kGMPQuotaExceededError;
- case kUnknownError: return kGMPInvalidModificationError; // Note: Unique placeholder.
- case kClientError: return kGMPAbortError; // Note: Unique placeholder.
- case kOutputError: return kGMPSecurityError; // Note: Unique placeholder.
- };
- return kGMPTimeoutError; // Note: Unique placeholder.
+// Align with spec, the Exceptions used by CDM to reject promises .
+// https://w3c.github.io/encrypted-media/#exceptions
+cdm::Exception
+ConvertCDMErrorToCDMException(cdm::Error error) {
+ switch (error) {
+ case cdm::kNotSupportedError:
+ return cdm::Exception::kExceptionNotSupportedError;
+ case cdm::kInvalidStateError:
+ return cdm::Exception::kExceptionInvalidStateError;
+ case cdm::kInvalidAccessError:
+ return cdm::Exception::kExceptionTypeError;
+ case cdm::kQuotaExceededError:
+ return cdm::Exception::kExceptionQuotaExceededError;
+ break;
+ }
+
+ return cdm::Exception::kExceptionInvalidStateError;
}
void
WidevineDecryptor::OnRejectPromise(uint32_t aPromiseId,
- Error aError,
- uint32_t aSystemCode,
- const char* aErrorMessage,
- uint32_t aErrorMessageSize)
+ cdm::Exception aException,
+ uint32_t aSystemCode,
+ const char* aErrorMessage,
+ uint32_t aErrorMessageSize)
{
if (!mCallback) {
Log("Decryptor::OnRejectPromise(aPromiseId=%d, err=%d, sysCode=%u, msg=%s) FAIL; !mCallback",
- aPromiseId, (int)aError, aSystemCode, aErrorMessage);
+ aPromiseId, (int)aException, aSystemCode, aErrorMessage);
return;
}
Log("Decryptor::OnRejectPromise(aPromiseId=%d, err=%d, sysCode=%u, msg=%s)",
aPromiseId, (int)aError, aSystemCode, aErrorMessage);
mCallback->RejectPromise(aPromiseId,
- ToGMPDOMException(aError),
+ ToGMPDOMException(aException),
!aErrorMessageSize ? "" : aErrorMessage,
aErrorMessageSize);
}
@@ -385,12 +390,10 @@ ToGMPMessageType(MessageType message_type)
void
WidevineDecryptor::OnSessionMessage(const char* aSessionId,
- uint32_t aSessionIdSize,
- MessageType aMessageType,
- const char* aMessage,
- uint32_t aMessageSize,
- const char* aLegacyDestinationUrl,
- uint32_t aLegacyDestinationUrlLength)
+ uint32_t aSessionIdSize,
+ cdm::MessageType aMessageType,
+ const char* aMessage,
+ uint32_t aMessageSize)
{
if (!mCallback) {
Log("Decryptor::OnSessionMessage() FAIL; !mCallback");