Chromium Code Reviews| 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. |