Merge MaxNumberOfSessions changes from CDM

Bug: 18377675

Implement new OEMCrypto function to get max number of sessions
https://widevine-internal-review.googlesource.com/#/c/12980/

Add oemcrypto static adapter for v9
https://widevine-internal-review.googlesource.com/#/c/13022/

Support new property to query MaxNumberOfSessions in CDM
https://widevine-internal-review.googlesource.com/#/c/13020/

Fix GetHdcpCapabilities incorrect return if not initialized
https://widevine-internal-review.googlesource.com/#/c/13210/

Change-Id: I02738c543cedd6e38d8826f845fec6cb2b1ede3c
This commit is contained in:
KongQun Yang
2015-02-19 16:52:23 -08:00
committed by John "Juce" Bruce
parent 891bd057f4
commit 23c95a1251
11 changed files with 199 additions and 74 deletions

View File

@@ -951,7 +951,13 @@ bool CryptoSession::RewrapDeviceRSAKey(const std::string& message,
bool CryptoSession::GetHdcpCapabilities(OemCryptoHdcpVersion* current_version,
OemCryptoHdcpVersion* max_version) {
LOGV("GetHdcpCapabilities: id=%ld", (uint32_t)oec_session_id_);
if (!initialized_) return UNKNOWN_ERROR;
if (!initialized_) return false;
if (current_version == NULL || max_version == NULL) {
LOGE(
"CryptoSession::GetHdcpCapabilities: |current_version|, "
"|max_version| cannot be NULL");
return false;
}
OEMCrypto_HDCP_Capability current, max;
OEMCryptoResult status = OEMCrypto_GetHDCPCapability(&current, &max);
@@ -980,4 +986,22 @@ bool CryptoSession::GetRandom(size_t data_length, uint8_t* random_data) {
return true;
}
bool CryptoSession::GetMaxNumberOfSessions(size_t* max) {
LOGV("GetMaxNumberOfSessions");
if (!initialized_) return false;
if (max == NULL) {
LOGE("CryptoSession::GetMaxNumberOfSessions: |max| cannot be NULL");
return false;
}
size_t max_sessions;
OEMCryptoResult status = OEMCrypto_GetMaxNumberOfSessions(&max_sessions);
if (OEMCrypto_SUCCESS != status) {
LOGW("OEMCrypto_GetMaxNumberOfSessions fails with %d", status);
return false;
}
*max = max_sessions;
return true;
}
}; // namespace wvcdm