Merge "Protect against race conditions when adding a license"
This commit is contained in:
@@ -396,7 +396,16 @@ CdmResponseType CdmEngine::AddKey(const CdmSessionId& session_id,
|
|||||||
return EMPTY_KEY_DATA_1;
|
return EMPTY_KEY_DATA_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CdmResponseType sts = session->AddKey(key_data);
|
CdmResponseType sts = KEY_ADDED;
|
||||||
|
{
|
||||||
|
// TODO(rfrias): Refactor. For now lock while adding keys to prevent
|
||||||
|
// a race condition between this and the decryption thread. This may
|
||||||
|
// occur if |policy_timers_| is reset when PolicyEngine::SetLicense
|
||||||
|
// is called.
|
||||||
|
std::unique_lock<std::recursive_mutex> lock(session_map_lock_);
|
||||||
|
sts = session->AddKey(key_data);
|
||||||
|
}
|
||||||
|
|
||||||
if (sts == KEY_ADDED) {
|
if (sts == KEY_ADDED) {
|
||||||
if (session->is_release()) {
|
if (session->is_release()) {
|
||||||
*license_type = kLicenseTypeRelease;
|
*license_type = kLicenseTypeRelease;
|
||||||
|
|||||||
Reference in New Issue
Block a user