Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: media/cdm/aes_decryptor.cc

Issue 2545083004: [eme] Handle multiple calls to MediaKeySession.close() (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/cdm/aes_decryptor.cc
diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc
index d6a720d4bade09d52f11c148101e1f94b46e92c5..eccaec36b9800be4f660e9c8d379b95433e0b8d5 100644
--- a/media/cdm/aes_decryptor.cc
+++ b/media/cdm/aes_decryptor.cc
@@ -405,9 +405,20 @@ void AesDecryptor::UpdateSession(const std::string& session_id,
// Runs the parallel steps from https://w3c.github.io/encrypted-media/#close.
void AesDecryptor::CloseSession(const std::string& session_id,
std::unique_ptr<SimpleCdmPromise> promise) {
- // Validate that this is a reference to an active session and then forget it.
+ // Validate that this is a reference to an active session. close() shouldn't
+ // be called if the session is already closed. However, the operation is
+ // asynchronous, so there is a window where close() was called a second time
+ // just before the closed event arrives. As a result it is possible that the
+ // session is already closed, so assume that the session is closed if it
+ // doesn't exist.
+ //
+ // close() is called from a MediaKeySession object, so it is unlikely that
+ // this method will be called with a previously unseen |session_id|.
std::set<std::string>::iterator it = valid_sessions_.find(session_id);
- DCHECK(it != valid_sessions_.end());
+ if (it == valid_sessions_.end()) {
xhwang 2016/12/07 06:51:42 Now we cannot detect an invalid sesion_id... Since
jrummell 2016/12/07 22:26:50 I don't think there is any way to get a invalid se
+ promise->resolve();
+ return;
+ }
// 5.1. Let cdm be the CDM instance represented by session's cdm instance
// value.

Powered by Google App Engine
This is Rietveld 408576698