Prevent race conditions between decrypt and close session
[ Merge of http://go/wvgerrit/47520 ] Bug: 73781703 Test: WV unit/integration tests, GTS GtsMediaTestCases tests and AUPT tests. Change-Id: I618ed8ca38855aecdb31e829a7f4041cbd505a02
This commit is contained in:
@@ -66,6 +66,11 @@ CdmSession::~CdmSession() {
|
||||
}
|
||||
}
|
||||
|
||||
void CdmSession::Close() {
|
||||
AutoLock lock(close_lock_);
|
||||
closed_ = true;
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::Init(
|
||||
CdmClientPropertySet* cdm_client_property_set) {
|
||||
return Init(cdm_client_property_set, NULL, NULL);
|
||||
@@ -567,10 +572,14 @@ CdmResponseType CdmSession::QueryOemCryptoSessionId(
|
||||
// Decrypt() - Accept encrypted buffer and return decrypted data.
|
||||
CdmResponseType CdmSession::Decrypt(const CdmDecryptionParameters& params) {
|
||||
if (!initialized_) {
|
||||
LOGE("CdmSession::Decrypt: not initialized");
|
||||
return NOT_INITIALIZED_ERROR;
|
||||
}
|
||||
|
||||
AutoLock lock(close_lock_);
|
||||
if (IsClosed()) {
|
||||
return SESSION_CLOSED_1;
|
||||
}
|
||||
|
||||
// Playback may not begin until either the start time passes or the license
|
||||
// is updated, so we treat this Decrypt call as invalid.
|
||||
if (params.is_encrypted) {
|
||||
|
||||
Reference in New Issue
Block a user