Chromium Code Reviews| 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 "content/renderer/media/crypto/ppapi_decryptor.h" | 5 #include "content/renderer/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 20 matching lines...) Expand all Loading... | |
| 31 const media::SessionClosedCB& session_closed_cb, | 31 const media::SessionClosedCB& session_closed_cb, |
| 32 const media::SessionErrorCB& session_error_cb, | 32 const media::SessionErrorCB& session_error_cb, |
| 33 const base::Closure& destroy_plugin_cb) { | 33 const base::Closure& destroy_plugin_cb) { |
| 34 ContentDecryptorDelegate* plugin_cdm_delegate = | 34 ContentDecryptorDelegate* plugin_cdm_delegate = |
| 35 plugin_instance->GetContentDecryptorDelegate(); | 35 plugin_instance->GetContentDecryptorDelegate(); |
| 36 if (!plugin_cdm_delegate) { | 36 if (!plugin_cdm_delegate) { |
| 37 DVLOG(1) << "PpapiDecryptor: plugin cdm delegate creation failed."; | 37 DVLOG(1) << "PpapiDecryptor: plugin cdm delegate creation failed."; |
| 38 return scoped_ptr<PpapiDecryptor>(); | 38 return scoped_ptr<PpapiDecryptor>(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 plugin_cdm_delegate->Initialize(key_system); | 41 return scoped_ptr<PpapiDecryptor>(new PpapiDecryptor(key_system, |
| 42 | 42 plugin_instance, |
| 43 return scoped_ptr<PpapiDecryptor>(new PpapiDecryptor(plugin_instance, | |
| 44 plugin_cdm_delegate, | 43 plugin_cdm_delegate, |
| 45 session_created_cb, | 44 session_created_cb, |
| 46 session_message_cb, | 45 session_message_cb, |
| 47 session_ready_cb, | 46 session_ready_cb, |
| 48 session_closed_cb, | 47 session_closed_cb, |
| 49 session_error_cb, | 48 session_error_cb, |
| 50 destroy_plugin_cb)); | 49 destroy_plugin_cb)); |
| 51 } | 50 } |
| 52 | 51 |
| 53 PpapiDecryptor::PpapiDecryptor( | 52 PpapiDecryptor::PpapiDecryptor( |
| 53 const std::string& key_system, | |
| 54 const scoped_refptr<PepperPluginInstanceImpl>& plugin_instance, | 54 const scoped_refptr<PepperPluginInstanceImpl>& plugin_instance, |
| 55 ContentDecryptorDelegate* plugin_cdm_delegate, | 55 ContentDecryptorDelegate* plugin_cdm_delegate, |
| 56 const media::SessionCreatedCB& session_created_cb, | 56 const media::SessionCreatedCB& session_created_cb, |
| 57 const media::SessionMessageCB& session_message_cb, | 57 const media::SessionMessageCB& session_message_cb, |
| 58 const media::SessionReadyCB& session_ready_cb, | 58 const media::SessionReadyCB& session_ready_cb, |
| 59 const media::SessionClosedCB& session_closed_cb, | 59 const media::SessionClosedCB& session_closed_cb, |
| 60 const media::SessionErrorCB& session_error_cb, | 60 const media::SessionErrorCB& session_error_cb, |
| 61 const base::Closure& destroy_plugin_cb) | 61 const base::Closure& destroy_plugin_cb) |
| 62 : plugin_instance_(plugin_instance), | 62 : plugin_instance_(plugin_instance), |
| 63 plugin_cdm_delegate_(plugin_cdm_delegate), | 63 plugin_cdm_delegate_(plugin_cdm_delegate), |
| 64 session_created_cb_(session_created_cb), | 64 session_created_cb_(session_created_cb), |
| 65 session_message_cb_(session_message_cb), | 65 session_message_cb_(session_message_cb), |
| 66 session_ready_cb_(session_ready_cb), | 66 session_ready_cb_(session_ready_cb), |
| 67 session_closed_cb_(session_closed_cb), | 67 session_closed_cb_(session_closed_cb), |
| 68 session_error_cb_(session_error_cb), | 68 session_error_cb_(session_error_cb), |
| 69 destroy_plugin_cb_(destroy_plugin_cb), | 69 destroy_plugin_cb_(destroy_plugin_cb), |
| 70 render_loop_proxy_(base::MessageLoopProxy::current()), | 70 render_loop_proxy_(base::MessageLoopProxy::current()), |
| 71 weak_ptr_factory_(this) { | 71 weak_ptr_factory_(this) { |
| 72 DCHECK(plugin_instance_.get()); | 72 DCHECK(plugin_instance_.get()); |
| 73 DCHECK(!session_created_cb_.is_null()); | 73 DCHECK(!session_created_cb_.is_null()); |
| 74 DCHECK(!session_message_cb_.is_null()); | 74 DCHECK(!session_message_cb_.is_null()); |
| 75 DCHECK(!session_ready_cb_.is_null()); | 75 DCHECK(!session_ready_cb_.is_null()); |
| 76 DCHECK(!session_closed_cb_.is_null()); | 76 DCHECK(!session_closed_cb_.is_null()); |
| 77 DCHECK(!session_error_cb_.is_null()); | 77 DCHECK(!session_error_cb_.is_null()); |
| 78 DCHECK(!destroy_plugin_cb_.is_null()); | 78 DCHECK(!destroy_plugin_cb_.is_null()); |
| 79 | 79 |
| 80 weak_this_ = weak_ptr_factory_.GetWeakPtr(); | 80 weak_this_ = weak_ptr_factory_.GetWeakPtr(); |
| 81 | 81 |
| 82 plugin_cdm_delegate_->SetSessionEventCallbacks( | 82 plugin_cdm_delegate_->Initialize( |
| 83 key_system, | |
| 83 base::Bind(&PpapiDecryptor::OnSessionCreated, weak_this_), | 84 base::Bind(&PpapiDecryptor::OnSessionCreated, weak_this_), |
| 84 base::Bind(&PpapiDecryptor::OnSessionMessage, weak_this_), | 85 base::Bind(&PpapiDecryptor::OnSessionMessage, weak_this_), |
| 85 base::Bind(&PpapiDecryptor::OnSessionReady, weak_this_), | 86 base::Bind(&PpapiDecryptor::OnSessionReady, weak_this_), |
| 86 base::Bind(&PpapiDecryptor::OnSessionClosed, weak_this_), | 87 base::Bind(&PpapiDecryptor::OnSessionClosed, weak_this_), |
| 87 base::Bind(&PpapiDecryptor::OnSessionError, weak_this_)); | 88 base::Bind(&PpapiDecryptor::OnSessionError, weak_this_), |
| 89 base::Bind(&PpapiDecryptor::OnPluginError, weak_this_)); | |
| 88 } | 90 } |
| 89 | 91 |
| 90 PpapiDecryptor::~PpapiDecryptor() { | 92 PpapiDecryptor::~PpapiDecryptor() { |
| 91 plugin_cdm_delegate_ = NULL; | 93 plugin_cdm_delegate_ = NULL; |
| 92 plugin_instance_ = NULL; | 94 plugin_instance_ = NULL; |
| 93 destroy_plugin_cb_.Run(); | 95 if (!destroy_plugin_cb_.is_null()) |
| 96 base::ResetAndReturn(&destroy_plugin_cb_).Run(); | |
| 94 } | 97 } |
| 95 | 98 |
| 96 bool PpapiDecryptor::CreateSession(uint32 session_id, | 99 bool PpapiDecryptor::CreateSession(uint32 session_id, |
| 97 const std::string& type, | 100 const std::string& type, |
| 98 const uint8* init_data, | 101 const uint8* init_data, |
| 99 int init_data_length) { | 102 int init_data_length) { |
| 100 DVLOG(2) << __FUNCTION__; | 103 DVLOG(2) << __FUNCTION__; |
| 101 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 104 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 102 DCHECK(plugin_cdm_delegate_); | 105 DCHECK(plugin_cdm_delegate_); |
| 103 | 106 |
| 104 if (!plugin_cdm_delegate_->CreateSession( | 107 if (!plugin_cdm_delegate_ || |
| 105 session_id, type, init_data, init_data_length)) { | 108 !plugin_cdm_delegate_->CreateSession( |
| 109 session_id, type, init_data, init_data_length)) { | |
| 106 ReportFailureToCallPlugin(session_id); | 110 ReportFailureToCallPlugin(session_id); |
| 107 return false; | 111 return false; |
| 108 } | 112 } |
| 109 | 113 |
| 110 return true; | 114 return true; |
| 111 } | 115 } |
| 112 | 116 |
| 113 void PpapiDecryptor::UpdateSession(uint32 session_id, | 117 void PpapiDecryptor::UpdateSession(uint32 session_id, |
| 114 const uint8* response, | 118 const uint8* response, |
| 115 int response_length) { | 119 int response_length) { |
| 116 DVLOG(2) << __FUNCTION__; | 120 DVLOG(2) << __FUNCTION__; |
| 117 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 121 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 118 | 122 |
| 119 if (!plugin_cdm_delegate_->UpdateSession( | 123 if (!plugin_cdm_delegate_ || !plugin_cdm_delegate_->UpdateSession( |
| 120 session_id, response, response_length)) | 124 session_id, response, response_length)) { |
|
xhwang
2014/01/08 23:19:14
This is clang-format style:)
| |
| 121 ReportFailureToCallPlugin(session_id); | 125 ReportFailureToCallPlugin(session_id); |
| 126 } | |
| 122 | 127 |
| 123 if (!new_audio_key_cb_.is_null()) | 128 if (!new_audio_key_cb_.is_null()) |
| 124 new_audio_key_cb_.Run(); | 129 new_audio_key_cb_.Run(); |
| 125 | 130 |
| 126 if (!new_video_key_cb_.is_null()) | 131 if (!new_video_key_cb_.is_null()) |
| 127 new_video_key_cb_.Run(); | 132 new_video_key_cb_.Run(); |
| 128 } | 133 } |
| 129 | 134 |
| 130 void PpapiDecryptor::ReleaseSession(uint32 session_id) { | 135 void PpapiDecryptor::ReleaseSession(uint32 session_id) { |
| 131 DVLOG(2) << __FUNCTION__; | 136 DVLOG(2) << __FUNCTION__; |
| 132 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 137 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 133 | 138 |
| 134 if (!plugin_cdm_delegate_->ReleaseSession(session_id)) | 139 if (!plugin_cdm_delegate_ || |
| 140 !plugin_cdm_delegate_->ReleaseSession(session_id)) { | |
| 135 ReportFailureToCallPlugin(session_id); | 141 ReportFailureToCallPlugin(session_id); |
| 142 } | |
| 136 } | 143 } |
| 137 | 144 |
| 138 media::Decryptor* PpapiDecryptor::GetDecryptor() { | 145 media::Decryptor* PpapiDecryptor::GetDecryptor() { |
| 139 #if defined(GOOGLE_TV) | 146 #if defined(GOOGLE_TV) |
| 140 // Google TV only uses PpapiDecrytor as a MediaKeys and does not need the | 147 // Google TV only uses PpapiDecrytor as a MediaKeys and does not need the |
| 141 // Decryptor interface of the PpapiDecryptor. | 148 // Decryptor interface of the PpapiDecryptor. |
| 142 // Details: If we don't do this GTV will be broken. The reason is that during | 149 // Details: If we don't do this GTV will be broken. The reason is that during |
| 143 // initialization, MediaSourceDelegate tries to use DecryptingDemuxerStream | 150 // initialization, MediaSourceDelegate tries to use DecryptingDemuxerStream |
| 144 // to decrypt the stream in the renderer process (for ClearKey support). | 151 // to decrypt the stream in the renderer process (for ClearKey support). |
| 145 // However, for GTV, PpapiDecryptor cannot do decryption at all. By returning | 152 // However, for GTV, PpapiDecryptor cannot do decryption at all. By returning |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 const scoped_refptr<media::DecoderBuffer>& encrypted, | 184 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 178 const DecryptCB& decrypt_cb) { | 185 const DecryptCB& decrypt_cb) { |
| 179 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 186 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
| 180 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 187 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 181 &PpapiDecryptor::Decrypt, weak_this_, | 188 &PpapiDecryptor::Decrypt, weak_this_, |
| 182 stream_type, encrypted, decrypt_cb)); | 189 stream_type, encrypted, decrypt_cb)); |
| 183 return; | 190 return; |
| 184 } | 191 } |
| 185 | 192 |
| 186 DVLOG(3) << __FUNCTION__ << " - stream_type: " << stream_type; | 193 DVLOG(3) << __FUNCTION__ << " - stream_type: " << stream_type; |
| 187 if (!plugin_cdm_delegate_->Decrypt(stream_type, encrypted, decrypt_cb)) | 194 if (!plugin_cdm_delegate_ || |
|
xhwang
2014/01/08 23:19:14
If I add a lock I can check this before the post (
| |
| 195 !plugin_cdm_delegate_->Decrypt(stream_type, encrypted, decrypt_cb)) { | |
| 188 decrypt_cb.Run(kError, NULL); | 196 decrypt_cb.Run(kError, NULL); |
| 197 } | |
| 189 } | 198 } |
| 190 | 199 |
| 191 void PpapiDecryptor::CancelDecrypt(StreamType stream_type) { | 200 void PpapiDecryptor::CancelDecrypt(StreamType stream_type) { |
| 192 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 201 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
| 193 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 202 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 194 &PpapiDecryptor::CancelDecrypt, weak_this_, stream_type)); | 203 &PpapiDecryptor::CancelDecrypt, weak_this_, stream_type)); |
| 195 return; | 204 return; |
| 196 } | 205 } |
| 197 | 206 |
| 198 DVLOG(1) << __FUNCTION__ << " - stream_type: " << stream_type; | 207 DVLOG(1) << __FUNCTION__ << " - stream_type: " << stream_type; |
| 199 plugin_cdm_delegate_->CancelDecrypt(stream_type); | 208 if (plugin_cdm_delegate_) |
| 209 plugin_cdm_delegate_->CancelDecrypt(stream_type); | |
| 200 } | 210 } |
| 201 | 211 |
| 202 void PpapiDecryptor::InitializeAudioDecoder( | 212 void PpapiDecryptor::InitializeAudioDecoder( |
| 203 const media::AudioDecoderConfig& config, | 213 const media::AudioDecoderConfig& config, |
| 204 const DecoderInitCB& init_cb) { | 214 const DecoderInitCB& init_cb) { |
| 205 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 215 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
| 206 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 216 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 207 &PpapiDecryptor::InitializeAudioDecoder, weak_this_, config, init_cb)); | 217 &PpapiDecryptor::InitializeAudioDecoder, weak_this_, config, init_cb)); |
| 208 return; | 218 return; |
| 209 } | 219 } |
| 210 | 220 |
| 211 DVLOG(2) << __FUNCTION__; | 221 DVLOG(2) << __FUNCTION__; |
| 212 DCHECK(config.is_encrypted()); | 222 DCHECK(config.is_encrypted()); |
| 213 DCHECK(config.IsValidConfig()); | 223 DCHECK(config.IsValidConfig()); |
| 214 | 224 |
| 215 audio_decoder_init_cb_ = init_cb; | 225 audio_decoder_init_cb_ = init_cb; |
| 216 if (!plugin_cdm_delegate_->InitializeAudioDecoder(config, base::Bind( | 226 if (!plugin_cdm_delegate_ || |
| 217 &PpapiDecryptor::OnDecoderInitialized, weak_this_, kAudio))) { | 227 !plugin_cdm_delegate_->InitializeAudioDecoder(config, base::Bind( |
| 228 &PpapiDecryptor::OnDecoderInitialized, weak_this_, kAudio))) { | |
| 218 base::ResetAndReturn(&audio_decoder_init_cb_).Run(false); | 229 base::ResetAndReturn(&audio_decoder_init_cb_).Run(false); |
| 219 return; | 230 return; |
| 220 } | 231 } |
| 221 } | 232 } |
| 222 | 233 |
| 223 void PpapiDecryptor::InitializeVideoDecoder( | 234 void PpapiDecryptor::InitializeVideoDecoder( |
| 224 const media::VideoDecoderConfig& config, | 235 const media::VideoDecoderConfig& config, |
| 225 const DecoderInitCB& init_cb) { | 236 const DecoderInitCB& init_cb) { |
| 226 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 237 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
| 227 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 238 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 228 &PpapiDecryptor::InitializeVideoDecoder, weak_this_, config, init_cb)); | 239 &PpapiDecryptor::InitializeVideoDecoder, weak_this_, config, init_cb)); |
| 229 return; | 240 return; |
| 230 } | 241 } |
| 231 | 242 |
| 232 DVLOG(2) << __FUNCTION__; | 243 DVLOG(2) << __FUNCTION__; |
| 233 DCHECK(config.is_encrypted()); | 244 DCHECK(config.is_encrypted()); |
| 234 DCHECK(config.IsValidConfig()); | 245 DCHECK(config.IsValidConfig()); |
| 235 | 246 |
| 236 video_decoder_init_cb_ = init_cb; | 247 video_decoder_init_cb_ = init_cb; |
| 237 if (!plugin_cdm_delegate_->InitializeVideoDecoder(config, base::Bind( | 248 if (!plugin_cdm_delegate_ || |
| 238 &PpapiDecryptor::OnDecoderInitialized, weak_this_, kVideo))) { | 249 !plugin_cdm_delegate_->InitializeVideoDecoder(config, base::Bind( |
| 250 &PpapiDecryptor::OnDecoderInitialized, weak_this_, kVideo))) { | |
| 239 base::ResetAndReturn(&video_decoder_init_cb_).Run(false); | 251 base::ResetAndReturn(&video_decoder_init_cb_).Run(false); |
| 240 return; | 252 return; |
| 241 } | 253 } |
| 242 } | 254 } |
| 243 | 255 |
| 244 void PpapiDecryptor::DecryptAndDecodeAudio( | 256 void PpapiDecryptor::DecryptAndDecodeAudio( |
| 245 const scoped_refptr<media::DecoderBuffer>& encrypted, | 257 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 246 const AudioDecodeCB& audio_decode_cb) { | 258 const AudioDecodeCB& audio_decode_cb) { |
| 247 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 259 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
| 248 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 260 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 249 &PpapiDecryptor::DecryptAndDecodeAudio, weak_this_, | 261 &PpapiDecryptor::DecryptAndDecodeAudio, weak_this_, |
| 250 encrypted, audio_decode_cb)); | 262 encrypted, audio_decode_cb)); |
| 251 return; | 263 return; |
| 252 } | 264 } |
| 253 | 265 |
| 254 DVLOG(3) << __FUNCTION__; | 266 DVLOG(3) << __FUNCTION__; |
| 255 if (!plugin_cdm_delegate_->DecryptAndDecodeAudio(encrypted, audio_decode_cb)) | 267 if (!plugin_cdm_delegate_ || !plugin_cdm_delegate_->DecryptAndDecodeAudio( |
| 268 encrypted, audio_decode_cb)) { | |
| 256 audio_decode_cb.Run(kError, AudioBuffers()); | 269 audio_decode_cb.Run(kError, AudioBuffers()); |
| 270 } | |
| 257 } | 271 } |
| 258 | 272 |
| 259 void PpapiDecryptor::DecryptAndDecodeVideo( | 273 void PpapiDecryptor::DecryptAndDecodeVideo( |
| 260 const scoped_refptr<media::DecoderBuffer>& encrypted, | 274 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 261 const VideoDecodeCB& video_decode_cb) { | 275 const VideoDecodeCB& video_decode_cb) { |
| 262 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 276 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
| 263 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 277 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 264 &PpapiDecryptor::DecryptAndDecodeVideo, weak_this_, | 278 &PpapiDecryptor::DecryptAndDecodeVideo, weak_this_, |
| 265 encrypted, video_decode_cb)); | 279 encrypted, video_decode_cb)); |
| 266 return; | 280 return; |
| 267 } | 281 } |
| 268 | 282 |
| 269 DVLOG(3) << __FUNCTION__; | 283 DVLOG(3) << __FUNCTION__; |
| 270 if (!plugin_cdm_delegate_->DecryptAndDecodeVideo(encrypted, video_decode_cb)) | 284 if (!plugin_cdm_delegate_ || !plugin_cdm_delegate_->DecryptAndDecodeVideo( |
| 285 encrypted, video_decode_cb)) { | |
| 271 video_decode_cb.Run(kError, NULL); | 286 video_decode_cb.Run(kError, NULL); |
| 287 } | |
| 272 } | 288 } |
| 273 | 289 |
| 274 void PpapiDecryptor::ResetDecoder(StreamType stream_type) { | 290 void PpapiDecryptor::ResetDecoder(StreamType stream_type) { |
| 275 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 291 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
| 276 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 292 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 277 &PpapiDecryptor::ResetDecoder, weak_this_, stream_type)); | 293 &PpapiDecryptor::ResetDecoder, weak_this_, stream_type)); |
| 278 return; | 294 return; |
| 279 } | 295 } |
| 280 | 296 |
| 281 DVLOG(2) << __FUNCTION__ << " - stream_type: " << stream_type; | 297 DVLOG(2) << __FUNCTION__ << " - stream_type: " << stream_type; |
| 282 plugin_cdm_delegate_->ResetDecoder(stream_type); | 298 if (plugin_cdm_delegate_) |
| 299 plugin_cdm_delegate_->ResetDecoder(stream_type); | |
| 283 } | 300 } |
| 284 | 301 |
| 285 void PpapiDecryptor::DeinitializeDecoder(StreamType stream_type) { | 302 void PpapiDecryptor::DeinitializeDecoder(StreamType stream_type) { |
| 286 if (!render_loop_proxy_->BelongsToCurrentThread()) { | 303 if (!render_loop_proxy_->BelongsToCurrentThread()) { |
| 287 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 304 render_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
| 288 &PpapiDecryptor::DeinitializeDecoder, weak_this_, stream_type)); | 305 &PpapiDecryptor::DeinitializeDecoder, weak_this_, stream_type)); |
| 289 return; | 306 return; |
| 290 } | 307 } |
| 291 | 308 |
| 292 DVLOG(2) << __FUNCTION__ << " - stream_type: " << stream_type; | 309 DVLOG(2) << __FUNCTION__ << " - stream_type: " << stream_type; |
| 293 plugin_cdm_delegate_->DeinitializeDecoder(stream_type); | 310 if (plugin_cdm_delegate_) |
| 311 plugin_cdm_delegate_->DeinitializeDecoder(stream_type); | |
| 294 } | 312 } |
| 295 | 313 |
| 296 void PpapiDecryptor::ReportFailureToCallPlugin(uint32 session_id) { | 314 void PpapiDecryptor::ReportFailureToCallPlugin(uint32 session_id) { |
| 297 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 315 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 298 DVLOG(1) << "Failed to call plugin."; | 316 DVLOG(1) << "Failed to call plugin."; |
| 299 session_error_cb_.Run(session_id, kUnknownError, 0); | 317 session_error_cb_.Run(session_id, kUnknownError, 0); |
| 300 } | 318 } |
| 301 | 319 |
| 302 void PpapiDecryptor::OnDecoderInitialized(StreamType stream_type, | 320 void PpapiDecryptor::OnDecoderInitialized(StreamType stream_type, |
| 303 bool success) { | 321 bool success) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 session_closed_cb_.Run(session_id); | 357 session_closed_cb_.Run(session_id); |
| 340 } | 358 } |
| 341 | 359 |
| 342 void PpapiDecryptor::OnSessionError(uint32 session_id, | 360 void PpapiDecryptor::OnSessionError(uint32 session_id, |
| 343 media::MediaKeys::KeyError error_code, | 361 media::MediaKeys::KeyError error_code, |
| 344 int system_code) { | 362 int system_code) { |
| 345 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 363 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 346 session_error_cb_.Run(session_id, error_code, system_code); | 364 session_error_cb_.Run(session_id, error_code, system_code); |
| 347 } | 365 } |
| 348 | 366 |
| 367 void PpapiDecryptor::OnPluginError() { | |
| 368 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | |
| 369 DCHECK(plugin_cdm_delegate_); | |
| 370 plugin_cdm_delegate_ = NULL; | |
| 371 plugin_instance_ = NULL; | |
| 372 base::ResetAndReturn(&destroy_plugin_cb_).Run(); | |
|
ddorwin
2014/01/08 23:40:32
This probably exposes/tests new paths related to W
xhwang
2014/01/09 01:58:49
:) Let's see.
| |
| 373 } | |
| 374 | |
| 349 } // namespace content | 375 } // namespace content |
| OLD | NEW |