OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/media/crypto/proxy_decryptor.h" | 5 #include "webkit/media/crypto/proxy_decryptor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "media/crypto/aes_decryptor.h" | 10 #include "media/crypto/aes_decryptor.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 int init_data_length) { | 110 int init_data_length) { |
111 // We do not support run-time switching of decryptors. GenerateKeyRequest() | 111 // We do not support run-time switching of decryptors. GenerateKeyRequest() |
112 // only creates a new decryptor when |decryptor_| is not initialized. | 112 // only creates a new decryptor when |decryptor_| is not initialized. |
113 DVLOG(1) << "GenerateKeyRequest: key_system = " << key_system; | 113 DVLOG(1) << "GenerateKeyRequest: key_system = " << key_system; |
114 | 114 |
115 base::AutoLock auto_lock(lock_); | 115 base::AutoLock auto_lock(lock_); |
116 | 116 |
117 if (!decryptor_) { | 117 if (!decryptor_) { |
118 decryptor_ = CreateDecryptor(key_system); | 118 decryptor_ = CreateDecryptor(key_system); |
119 if (!decryptor_) { | 119 if (!decryptor_) { |
120 key_error_cb_.Run(key_system, "", media::Decryptor::kClientError, 0); | 120 key_error_cb_.Run( |
| 121 key_system, std::string(), media::Decryptor::kClientError, 0); |
121 return false; | 122 return false; |
122 } | 123 } |
123 } | 124 } |
124 | 125 |
125 if (!decryptor_->GenerateKeyRequest(key_system, type, | 126 if (!decryptor_->GenerateKeyRequest(key_system, type, |
126 init_data, init_data_length)) { | 127 init_data, init_data_length)) { |
127 decryptor_.reset(); | 128 decryptor_.reset(); |
128 return false; | 129 return false; |
129 } | 130 } |
130 | 131 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 void ProxyDecryptor::NeedKey(const std::string& key_system, | 216 void ProxyDecryptor::NeedKey(const std::string& key_system, |
216 const std::string& session_id, | 217 const std::string& session_id, |
217 const std::string& type, | 218 const std::string& type, |
218 scoped_ptr<uint8[]> init_data, | 219 scoped_ptr<uint8[]> init_data, |
219 int init_data_size) { | 220 int init_data_size) { |
220 need_key_cb_.Run(key_system, session_id, type, | 221 need_key_cb_.Run(key_system, session_id, type, |
221 init_data.Pass(), init_data_size); | 222 init_data.Pass(), init_data_size); |
222 } | 223 } |
223 | 224 |
224 } // namespace webkit_media | 225 } // namespace webkit_media |
OLD | NEW |