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/ppapi_decryptor.h" | 5 #include "webkit/media/crypto/ppapi_decryptor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 if (!plugin_cdm_delegate_->Decrypt(stream_type, encrypted, decrypt_cb)) | 134 if (!plugin_cdm_delegate_->Decrypt(stream_type, encrypted, decrypt_cb)) |
135 decrypt_cb.Run(kError, NULL); | 135 decrypt_cb.Run(kError, NULL); |
136 } | 136 } |
137 | 137 |
138 void PpapiDecryptor::CancelDecrypt(StreamType stream_type) { | 138 void PpapiDecryptor::CancelDecrypt(StreamType stream_type) { |
139 DVLOG(1) << "CancelDecrypt() - stream_type: " << stream_type; | 139 DVLOG(1) << "CancelDecrypt() - stream_type: " << stream_type; |
140 plugin_cdm_delegate_->CancelDecrypt(stream_type); | 140 plugin_cdm_delegate_->CancelDecrypt(stream_type); |
141 } | 141 } |
142 | 142 |
143 void PpapiDecryptor::InitializeAudioDecoder( | 143 void PpapiDecryptor::InitializeAudioDecoder( |
144 scoped_ptr<media::AudioDecoderConfig> config, | 144 const media::AudioDecoderConfig& config, |
145 const DecoderInitCB& init_cb) { | 145 const DecoderInitCB& init_cb) { |
146 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 146 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
147 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 147 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
148 &PpapiDecryptor::InitializeAudioDecoder, weak_this_, | 148 &PpapiDecryptor::InitializeAudioDecoder, weak_this_, config, init_cb)); |
149 base::Passed(&config), init_cb)); | |
150 return; | 149 return; |
151 } | 150 } |
152 | 151 |
153 DVLOG(2) << "InitializeAudioDecoder()"; | 152 DVLOG(2) << "InitializeAudioDecoder()"; |
154 DCHECK(config->is_encrypted()); | 153 DCHECK(config.is_encrypted()); |
155 DCHECK(config->IsValidConfig()); | 154 DCHECK(config.IsValidConfig()); |
156 | 155 |
157 audio_decoder_init_cb_ = init_cb; | 156 audio_decoder_init_cb_ = init_cb; |
158 if (!plugin_cdm_delegate_->InitializeAudioDecoder(*config, base::Bind( | 157 if (!plugin_cdm_delegate_->InitializeAudioDecoder(config, base::Bind( |
159 &PpapiDecryptor::OnDecoderInitialized, weak_this_, kAudio))) { | 158 &PpapiDecryptor::OnDecoderInitialized, weak_this_, kAudio))) { |
160 base::ResetAndReturn(&audio_decoder_init_cb_).Run(false); | 159 base::ResetAndReturn(&audio_decoder_init_cb_).Run(false); |
161 return; | 160 return; |
162 } | 161 } |
163 } | 162 } |
164 | 163 |
165 void PpapiDecryptor::InitializeVideoDecoder( | 164 void PpapiDecryptor::InitializeVideoDecoder( |
166 const media::VideoDecoderConfig& config, | 165 const media::VideoDecoderConfig& config, |
167 const DecoderInitCB& init_cb) { | 166 const DecoderInitCB& init_cb) { |
168 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 167 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const std::string& session_id, | 282 const std::string& session_id, |
284 const std::string& type, | 283 const std::string& type, |
285 scoped_array<uint8> init_data, | 284 scoped_array<uint8> init_data, |
286 int init_data_size) { | 285 int init_data_size) { |
287 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 286 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
288 need_key_cb_.Run(key_system, session_id, type, | 287 need_key_cb_.Run(key_system, session_id, type, |
289 init_data.Pass(), init_data_size); | 288 init_data.Pass(), init_data_size); |
290 } | 289 } |
291 | 290 |
292 } // namespace webkit_media | 291 } // namespace webkit_media |
OLD | NEW |