OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/cdm/proxy_decryptor.h" | 5 #include "media/cdm/proxy_decryptor.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 } | 87 } |
88 | 88 |
89 void ProxyDecryptor::OnCdmCreated(const std::string& key_system, | 89 void ProxyDecryptor::OnCdmCreated(const std::string& key_system, |
90 const GURL& security_origin, | 90 const GURL& security_origin, |
91 const CdmContextReadyCB& cdm_context_ready_cb, | 91 const CdmContextReadyCB& cdm_context_ready_cb, |
92 scoped_ptr<MediaKeys> cdm) { | 92 scoped_ptr<MediaKeys> cdm) { |
93 is_creating_cdm_ = false; | 93 is_creating_cdm_ = false; |
94 | 94 |
95 if (!cdm) { | 95 if (!cdm) { |
96 cdm_context_ready_cb.Run(nullptr); | 96 cdm_context_ready_cb.Run(nullptr); |
97 return; | 97 } else { |
ddorwin
2015/05/04 22:46:02
Now we complete pending GKRs whereas we didn't bef
jrummell
2015/05/05 00:54:18
Correct. The ECKPrefixedEncryptedMediaTest.Initial
| |
98 key_system_ = key_system; | |
99 security_origin_ = security_origin; | |
100 is_clear_key_ = IsClearKey(key_system) || IsExternalClearKey(key_system); | |
101 media_keys_ = cdm.Pass(); | |
102 | |
103 cdm_context_ready_cb.Run(media_keys_->GetCdmContext()); | |
98 } | 104 } |
99 | 105 |
100 key_system_ = key_system; | |
101 security_origin_ = security_origin; | |
102 is_clear_key_ = IsClearKey(key_system) || IsExternalClearKey(key_system); | |
103 media_keys_ = cdm.Pass(); | |
104 | |
105 cdm_context_ready_cb.Run(media_keys_->GetCdmContext()); | |
106 | |
107 for (const auto& request : pending_requests_) | 106 for (const auto& request : pending_requests_) |
108 GenerateKeyRequestInternal(request->init_data_type, request->init_data); | 107 GenerateKeyRequestInternal(request->init_data_type, request->init_data); |
109 | 108 |
110 pending_requests_.clear(); | 109 pending_requests_.clear(); |
111 } | 110 } |
112 | 111 |
113 void ProxyDecryptor::GenerateKeyRequest(EmeInitDataType init_data_type, | 112 void ProxyDecryptor::GenerateKeyRequest(EmeInitDataType init_data_type, |
114 const uint8* init_data, | 113 const uint8* init_data, |
115 int init_data_length) { | 114 int init_data_length) { |
116 std::vector<uint8> init_data_vector(init_data, init_data + init_data_length); | 115 std::vector<uint8> init_data_vector(init_data, init_data + init_data_length); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 bool is_persistent = | 387 bool is_persistent = |
389 session_type == PersistentSession || session_type == LoadSession; | 388 session_type == PersistentSession || session_type == LoadSession; |
390 active_sessions_.insert(std::make_pair(session_id, is_persistent)); | 389 active_sessions_.insert(std::make_pair(session_id, is_persistent)); |
391 | 390 |
392 // For LoadSession(), generate the KeyAdded event. | 391 // For LoadSession(), generate the KeyAdded event. |
393 if (session_type == LoadSession) | 392 if (session_type == LoadSession) |
394 GenerateKeyAdded(session_id); | 393 GenerateKeyAdded(session_id); |
395 } | 394 } |
396 | 395 |
397 } // namespace media | 396 } // namespace media |
OLD | NEW |