Update usage table when session is closed

Merge from the widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/13310/

Bug: 19003762
Change-Id: Icaa1978c16437d36c99b0b0dabbbfa15fe469bc3
This commit is contained in:
KongQun Yang
2015-03-02 15:21:03 -08:00
parent fc2b694b4f
commit a0b016ecf6
2 changed files with 8 additions and 0 deletions

View File

@@ -122,6 +122,7 @@ class CryptoSession {
static int session_count_;
bool open_;
bool update_usage_table_after_close_session_;
CryptoSessionId oec_session_id_;
OEMCryptoBufferType destination_buffer_type_;

View File

@@ -37,6 +37,7 @@ uint64_t CryptoSession::request_id_index_ = 0;
CryptoSession::CryptoSession()
: open_(false),
update_usage_table_after_close_session_(false),
is_destination_buffer_type_valid_(false),
requested_security_level_(kLevelDefault),
request_id_base_(0) {
@@ -270,6 +271,11 @@ void CryptoSession::Close() {
if (!open_) return;
if (OEMCrypto_SUCCESS == OEMCrypto_CloseSession(oec_session_id_)) {
open_ = false;
if (update_usage_table_after_close_session_) {
OEMCryptoResult sts = OEMCrypto_UpdateUsageTable();
if (sts != OEMCrypto_SUCCESS)
LOGW("CryptoSession::Close: OEMCrypto_UpdateUsageTable error=%ld", sts);
}
}
}
@@ -422,6 +428,7 @@ CdmResponseType CryptoSession::LoadKeys(
if (OEMCrypto_SUCCESS == sts) {
if (!provider_session_token.empty()) {
update_usage_table_after_close_session_ = true;
sts = OEMCrypto_UpdateUsageTable();
if (sts != OEMCrypto_SUCCESS) {
LOGW("CryptoSession::LoadKeys: OEMCrypto_UpdateUsageTable error=%ld",