Avoid race conditions between periodic timer and close sessions

[ Merge of http://go/wvgerrit/49402 ]

Bug: 78912546
Test: WV unit/integration tests, GtsMediaTestCases, Aupt tests
Change-Id: Ic2016e8b557cd2dd45d5d3bbaa28be16e58dab8b
This commit is contained in:
Rahul Frias
2018-05-02 00:12:31 -07:00
parent 734b6b819e
commit 5b169b1722

View File

@@ -72,6 +72,7 @@ CdmResponseType WvContentDecryptionModule::CloseSession(
CdmEngine* cdm_engine = GetCdmForSessionId(session_id);
// TODO(rfrias): Avoid reusing the error codes from CdmEngine.
if (!cdm_engine) return SESSION_NOT_FOUND_1;
AutoLock auto_lock(cdms_lock_);
CdmResponseType sts = cdm_engine->CloseSession(session_id);
cdm_engine->GetMetrics()->cdm_engine_close_session_.Increment(sts);
if (sts == NO_ERROR) {