Protect against race conditions when removing keys
[ Merge of http://go/wvgerrit/142229 and http://go/ag/16147655 ] This adds concurrency protection to a session when keys or a license is removed from a session. Bug: 195625322 Test: GtsMediaTestCases, unit/integration tests, YT EME conformance test Change-Id: I38601a58dc593ce053cb5457b9d42d2c35f3f041
This commit is contained in:
@@ -455,6 +455,7 @@ CdmResponseType CdmEngine::RestoreKey(const CdmSessionId& session_id,
|
|||||||
CdmResponseType CdmEngine::RemoveKeys(const CdmSessionId& session_id) {
|
CdmResponseType CdmEngine::RemoveKeys(const CdmSessionId& session_id) {
|
||||||
LOGI("session_id = %s", IdToString(session_id));
|
LOGI("session_id = %s", IdToString(session_id));
|
||||||
std::shared_ptr<CdmSession> session;
|
std::shared_ptr<CdmSession> session;
|
||||||
|
std::unique_lock<std::recursive_mutex> lock(session_map_lock_);
|
||||||
if (!session_map_.FindSession(session_id, &session)) {
|
if (!session_map_.FindSession(session_id, &session)) {
|
||||||
LOGE("Session not found: session_id = %s", IdToString(session_id));
|
LOGE("Session not found: session_id = %s", IdToString(session_id));
|
||||||
return SESSION_NOT_FOUND_5;
|
return SESSION_NOT_FOUND_5;
|
||||||
@@ -466,6 +467,7 @@ CdmResponseType CdmEngine::RemoveKeys(const CdmSessionId& session_id) {
|
|||||||
CdmResponseType CdmEngine::RemoveLicense(const CdmSessionId& session_id) {
|
CdmResponseType CdmEngine::RemoveLicense(const CdmSessionId& session_id) {
|
||||||
LOGI("session_id = %s", IdToString(session_id));
|
LOGI("session_id = %s", IdToString(session_id));
|
||||||
std::shared_ptr<CdmSession> session;
|
std::shared_ptr<CdmSession> session;
|
||||||
|
std::unique_lock<std::recursive_mutex> lock(session_map_lock_);
|
||||||
if (!session_map_.FindSession(session_id, &session)) {
|
if (!session_map_.FindSession(session_id, &session)) {
|
||||||
LOGE("Session not found: session_id = %s", IdToString(session_id));
|
LOGE("Session not found: session_id = %s", IdToString(session_id));
|
||||||
return SESSION_NOT_FOUND_19;
|
return SESSION_NOT_FOUND_19;
|
||||||
|
|||||||
Reference in New Issue
Block a user