diff --git a/libwvdrmengine/cdm/core/include/crypto_session.h b/libwvdrmengine/cdm/core/include/crypto_session.h index b67890fa..147df355 100644 --- a/libwvdrmengine/cdm/core/include/crypto_session.h +++ b/libwvdrmengine/cdm/core/include/crypto_session.h @@ -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_; diff --git a/libwvdrmengine/cdm/core/src/crypto_session.cpp b/libwvdrmengine/cdm/core/src/crypto_session.cpp index 4a82a557..63031fbd 100644 --- a/libwvdrmengine/cdm/core/src/crypto_session.cpp +++ b/libwvdrmengine/cdm/core/src/crypto_session.cpp @@ -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",