Implement OEMCrypto_GetNumberOfOpenSessions

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13560/

Change-Id: Ie19bf3e57d0c4b1621b95bd5912a751ccfbaaa7b
This commit is contained in:
KongQun Yang
2015-03-11 09:37:21 -07:00
parent bd2ac27684
commit 46f26fe6ae
7 changed files with 57 additions and 10 deletions

View File

@@ -438,6 +438,12 @@ CdmResponseType CdmEngine::QueryStatus(CdmQueryMap* key_info) {
supports_usage_reporting ? QUERY_VALUE_TRUE : QUERY_VALUE_FALSE;
}
size_t number_of_open_sessions;
success = crypto_session.GetNumberOfOpenSessions(&number_of_open_sessions);
if (success) {
(*key_info)[QUERY_KEY_NUMBER_OF_OPEN_SESSIONS] = number_of_open_sessions;
}
size_t maximum_number_of_sessions;
success = crypto_session.GetMaxNumberOfSessions(&maximum_number_of_sessions);
if (success) {

View File

@@ -985,6 +985,24 @@ bool CryptoSession::GetRandom(size_t data_length, uint8_t* random_data) {
return true;
}
bool CryptoSession::GetNumberOfOpenSessions(size_t* count) {
LOGV("GetNumberOfOpenSessions");
if (!initialized_) return false;
if (count == NULL) {
LOGE("CryptoSession::GetNumberOfOpenSessions: |count| cannot be NULL");
return false;
}
size_t sessions_count;
OEMCryptoResult status = OEMCrypto_GetNumberOfOpenSessions(&sessions_count);
if (OEMCrypto_SUCCESS != status) {
LOGW("OEMCrypto_GetNumberOfOpenSessions fails with %d", status);
return false;
}
*count = sessions_count;
return true;
}
bool CryptoSession::GetMaxNumberOfSessions(size_t* max) {
LOGV("GetMaxNumberOfSessions");
if (!initialized_) return false;