Merge "CDM handles mixed output warnings." into rvc-dev am: d3f10ece7c
Change-Id: I8fcebbe44c80c38448915cff2ef506ccedc32865
This commit is contained in:
@@ -430,6 +430,13 @@ class CryptoSession {
|
||||
|
||||
uint32_t api_version_;
|
||||
|
||||
// Stores the most recent error code returned from a call to
|
||||
// OEMCrypto_DecryptCENC. This is used to reduce the total number of
|
||||
// error logs for decrypt calls, as there could be a large number of
|
||||
// same error code in sequence of each other. A value of
|
||||
// OEMCrypto_SUCCESS indicates that no error have yet occurred.
|
||||
OEMCryptoResult last_decrypt_error_ = OEMCrypto_SUCCESS;
|
||||
|
||||
// In order to avoid creating a deadlock if instantiation needs to take any
|
||||
// of the CryptoSession static mutexes, |factory_| is protected by its own
|
||||
// mutex that is only used in the two funtions that interact with it.
|
||||
@@ -437,7 +444,7 @@ class CryptoSession {
|
||||
static std::unique_ptr<CryptoSessionFactory> factory_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoSession);
|
||||
};
|
||||
}; // class CryptoSession
|
||||
|
||||
class CryptoSessionFactory {
|
||||
public:
|
||||
|
||||
@@ -1476,10 +1476,29 @@ CdmResponseType CryptoSession::Decrypt(
|
||||
}
|
||||
|
||||
// Perform decrypt
|
||||
OEMCryptoResult sts =
|
||||
const OEMCryptoResult sts =
|
||||
DecryptMultipleSamples(oec_samples, params.cipher_mode, oec_pattern);
|
||||
|
||||
if (sts != OEMCrypto_SUCCESS && last_decrypt_error_ != sts) {
|
||||
// Decrypt errors and warnings are only logged when the error code
|
||||
// changes. This is in anticipation that if an error code is
|
||||
// returned, then the same error code is likely to be returned in
|
||||
// the next call. The calling application may make several more
|
||||
// decrypt requests before the error is handled by the app.
|
||||
last_decrypt_error_ = sts;
|
||||
if (sts == OEMCrypto_WARNING_MIXED_OUTPUT_PROTECTION) {
|
||||
LOGW(
|
||||
"OEMCrypto_DecryptCENC is warning of mixed HDCP output protection: "
|
||||
"oec_session_id = %u",
|
||||
oec_session_id_);
|
||||
} else {
|
||||
LOGE("OEMCrypto_DecryptCENC failed: status = %d", static_cast<int>(sts));
|
||||
}
|
||||
}
|
||||
|
||||
switch (sts) {
|
||||
case OEMCrypto_SUCCESS:
|
||||
case OEMCrypto_WARNING_MIXED_OUTPUT_PROTECTION:
|
||||
return NO_ERROR;
|
||||
case OEMCrypto_ERROR_INSUFFICIENT_RESOURCES:
|
||||
return INSUFFICIENT_CRYPTO_RESOURCES_5;
|
||||
|
||||
Reference in New Issue
Block a user