| 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/cdm/ppapi_decryptor.h" | 5 #include "content/renderer/media/cdm/ppapi_decryptor.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 base::Bind(&PpapiDecryptor::OnLegacySessionError, weak_this), | 109 base::Bind(&PpapiDecryptor::OnLegacySessionError, weak_this), |
| 110 base::Bind(&PpapiDecryptor::OnSessionKeysChange, weak_this), | 110 base::Bind(&PpapiDecryptor::OnSessionKeysChange, weak_this), |
| 111 base::Bind(&PpapiDecryptor::OnSessionExpirationUpdate, weak_this), | 111 base::Bind(&PpapiDecryptor::OnSessionExpirationUpdate, weak_this), |
| 112 base::Bind(&PpapiDecryptor::OnFatalPluginError, weak_this), | 112 base::Bind(&PpapiDecryptor::OnFatalPluginError, weak_this), |
| 113 std::move(promise)); | 113 std::move(promise)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void PpapiDecryptor::SetServerCertificate( | 116 void PpapiDecryptor::SetServerCertificate( |
| 117 const std::vector<uint8_t>& certificate, | 117 const std::vector<uint8_t>& certificate, |
| 118 std::unique_ptr<media::SimpleCdmPromise> promise) { | 118 std::unique_ptr<media::SimpleCdmPromise> promise) { |
| 119 DVLOG(2) << __FUNCTION__; | 119 DVLOG(2) << __func__; |
| 120 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 120 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 121 | 121 |
| 122 if (!CdmDelegate()) { | 122 if (!CdmDelegate()) { |
| 123 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); | 123 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); |
| 124 return; | 124 return; |
| 125 } | 125 } |
| 126 | 126 |
| 127 CdmDelegate()->SetServerCertificate(certificate, std::move(promise)); | 127 CdmDelegate()->SetServerCertificate(certificate, std::move(promise)); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void PpapiDecryptor::CreateSessionAndGenerateRequest( | 130 void PpapiDecryptor::CreateSessionAndGenerateRequest( |
| 131 SessionType session_type, | 131 SessionType session_type, |
| 132 media::EmeInitDataType init_data_type, | 132 media::EmeInitDataType init_data_type, |
| 133 const std::vector<uint8_t>& init_data, | 133 const std::vector<uint8_t>& init_data, |
| 134 std::unique_ptr<media::NewSessionCdmPromise> promise) { | 134 std::unique_ptr<media::NewSessionCdmPromise> promise) { |
| 135 DVLOG(2) << __FUNCTION__; | 135 DVLOG(2) << __func__; |
| 136 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 136 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 137 | 137 |
| 138 if (!CdmDelegate()) { | 138 if (!CdmDelegate()) { |
| 139 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); | 139 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); |
| 140 return; | 140 return; |
| 141 } | 141 } |
| 142 | 142 |
| 143 CdmDelegate()->CreateSessionAndGenerateRequest(session_type, init_data_type, | 143 CdmDelegate()->CreateSessionAndGenerateRequest(session_type, init_data_type, |
| 144 init_data, std::move(promise)); | 144 init_data, std::move(promise)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void PpapiDecryptor::LoadSession( | 147 void PpapiDecryptor::LoadSession( |
| 148 SessionType session_type, | 148 SessionType session_type, |
| 149 const std::string& session_id, | 149 const std::string& session_id, |
| 150 std::unique_ptr<media::NewSessionCdmPromise> promise) { | 150 std::unique_ptr<media::NewSessionCdmPromise> promise) { |
| 151 DVLOG(2) << __FUNCTION__; | 151 DVLOG(2) << __func__; |
| 152 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 152 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 153 | 153 |
| 154 if (!CdmDelegate()) { | 154 if (!CdmDelegate()) { |
| 155 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); | 155 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); |
| 156 return; | 156 return; |
| 157 } | 157 } |
| 158 CdmDelegate()->LoadSession(session_type, session_id, std::move(promise)); | 158 CdmDelegate()->LoadSession(session_type, session_id, std::move(promise)); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void PpapiDecryptor::UpdateSession( | 161 void PpapiDecryptor::UpdateSession( |
| 162 const std::string& session_id, | 162 const std::string& session_id, |
| 163 const std::vector<uint8_t>& response, | 163 const std::vector<uint8_t>& response, |
| 164 std::unique_ptr<media::SimpleCdmPromise> promise) { | 164 std::unique_ptr<media::SimpleCdmPromise> promise) { |
| 165 DVLOG(2) << __FUNCTION__; | 165 DVLOG(2) << __func__; |
| 166 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 166 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 167 | 167 |
| 168 if (!CdmDelegate()) { | 168 if (!CdmDelegate()) { |
| 169 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); | 169 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); |
| 170 return; | 170 return; |
| 171 } | 171 } |
| 172 CdmDelegate()->UpdateSession(session_id, response, std::move(promise)); | 172 CdmDelegate()->UpdateSession(session_id, response, std::move(promise)); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void PpapiDecryptor::CloseSession( | 175 void PpapiDecryptor::CloseSession( |
| 176 const std::string& session_id, | 176 const std::string& session_id, |
| 177 std::unique_ptr<media::SimpleCdmPromise> promise) { | 177 std::unique_ptr<media::SimpleCdmPromise> promise) { |
| 178 DVLOG(2) << __FUNCTION__; | 178 DVLOG(2) << __func__; |
| 179 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 179 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 180 | 180 |
| 181 if (!CdmDelegate()) { | 181 if (!CdmDelegate()) { |
| 182 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); | 182 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); |
| 183 return; | 183 return; |
| 184 } | 184 } |
| 185 | 185 |
| 186 CdmDelegate()->CloseSession(session_id, std::move(promise)); | 186 CdmDelegate()->CloseSession(session_id, std::move(promise)); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void PpapiDecryptor::RemoveSession( | 189 void PpapiDecryptor::RemoveSession( |
| 190 const std::string& session_id, | 190 const std::string& session_id, |
| 191 std::unique_ptr<media::SimpleCdmPromise> promise) { | 191 std::unique_ptr<media::SimpleCdmPromise> promise) { |
| 192 DVLOG(2) << __FUNCTION__; | 192 DVLOG(2) << __func__; |
| 193 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 193 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 194 | 194 |
| 195 if (!CdmDelegate()) { | 195 if (!CdmDelegate()) { |
| 196 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); | 196 promise->reject(INVALID_STATE_ERROR, 0, "CDM has failed."); |
| 197 return; | 197 return; |
| 198 } | 198 } |
| 199 | 199 |
| 200 CdmDelegate()->RemoveSession(session_id, std::move(promise)); | 200 CdmDelegate()->RemoveSession(session_id, std::move(promise)); |
| 201 } | 201 } |
| 202 | 202 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 215 void PpapiDecryptor::RegisterNewKeyCB(StreamType stream_type, | 215 void PpapiDecryptor::RegisterNewKeyCB(StreamType stream_type, |
| 216 const NewKeyCB& new_key_cb) { | 216 const NewKeyCB& new_key_cb) { |
| 217 if (!render_task_runner_->BelongsToCurrentThread()) { | 217 if (!render_task_runner_->BelongsToCurrentThread()) { |
| 218 render_task_runner_->PostTask( | 218 render_task_runner_->PostTask( |
| 219 FROM_HERE, | 219 FROM_HERE, |
| 220 base::Bind(&PpapiDecryptor::RegisterNewKeyCB, | 220 base::Bind(&PpapiDecryptor::RegisterNewKeyCB, |
| 221 weak_ptr_factory_.GetWeakPtr(), stream_type, new_key_cb)); | 221 weak_ptr_factory_.GetWeakPtr(), stream_type, new_key_cb)); |
| 222 return; | 222 return; |
| 223 } | 223 } |
| 224 | 224 |
| 225 DVLOG(3) << __FUNCTION__ << " - stream_type: " << stream_type; | 225 DVLOG(3) << __func__ << " - stream_type: " << stream_type; |
| 226 switch (stream_type) { | 226 switch (stream_type) { |
| 227 case kAudio: | 227 case kAudio: |
| 228 new_audio_key_cb_ = new_key_cb; | 228 new_audio_key_cb_ = new_key_cb; |
| 229 break; | 229 break; |
| 230 case kVideo: | 230 case kVideo: |
| 231 new_video_key_cb_ = new_key_cb; | 231 new_video_key_cb_ = new_key_cb; |
| 232 break; | 232 break; |
| 233 default: | 233 default: |
| 234 NOTREACHED(); | 234 NOTREACHED(); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 void PpapiDecryptor::Decrypt( | 238 void PpapiDecryptor::Decrypt( |
| 239 StreamType stream_type, | 239 StreamType stream_type, |
| 240 const scoped_refptr<media::DecoderBuffer>& encrypted, | 240 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 241 const DecryptCB& decrypt_cb) { | 241 const DecryptCB& decrypt_cb) { |
| 242 if (!render_task_runner_->BelongsToCurrentThread()) { | 242 if (!render_task_runner_->BelongsToCurrentThread()) { |
| 243 render_task_runner_->PostTask( | 243 render_task_runner_->PostTask( |
| 244 FROM_HERE, | 244 FROM_HERE, |
| 245 base::Bind(&PpapiDecryptor::Decrypt, weak_ptr_factory_.GetWeakPtr(), | 245 base::Bind(&PpapiDecryptor::Decrypt, weak_ptr_factory_.GetWeakPtr(), |
| 246 stream_type, encrypted, decrypt_cb)); | 246 stream_type, encrypted, decrypt_cb)); |
| 247 return; | 247 return; |
| 248 } | 248 } |
| 249 | 249 |
| 250 DVLOG(3) << __FUNCTION__ << " - stream_type: " << stream_type; | 250 DVLOG(3) << __func__ << " - stream_type: " << stream_type; |
| 251 if (!CdmDelegate() || | 251 if (!CdmDelegate() || |
| 252 !CdmDelegate()->Decrypt(stream_type, encrypted, decrypt_cb)) { | 252 !CdmDelegate()->Decrypt(stream_type, encrypted, decrypt_cb)) { |
| 253 decrypt_cb.Run(kError, NULL); | 253 decrypt_cb.Run(kError, NULL); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 void PpapiDecryptor::CancelDecrypt(StreamType stream_type) { | 257 void PpapiDecryptor::CancelDecrypt(StreamType stream_type) { |
| 258 if (!render_task_runner_->BelongsToCurrentThread()) { | 258 if (!render_task_runner_->BelongsToCurrentThread()) { |
| 259 render_task_runner_->PostTask( | 259 render_task_runner_->PostTask( |
| 260 FROM_HERE, base::Bind(&PpapiDecryptor::CancelDecrypt, | 260 FROM_HERE, base::Bind(&PpapiDecryptor::CancelDecrypt, |
| 261 weak_ptr_factory_.GetWeakPtr(), stream_type)); | 261 weak_ptr_factory_.GetWeakPtr(), stream_type)); |
| 262 return; | 262 return; |
| 263 } | 263 } |
| 264 | 264 |
| 265 DVLOG(1) << __FUNCTION__ << " - stream_type: " << stream_type; | 265 DVLOG(1) << __func__ << " - stream_type: " << stream_type; |
| 266 if (CdmDelegate()) | 266 if (CdmDelegate()) |
| 267 CdmDelegate()->CancelDecrypt(stream_type); | 267 CdmDelegate()->CancelDecrypt(stream_type); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void PpapiDecryptor::InitializeAudioDecoder( | 270 void PpapiDecryptor::InitializeAudioDecoder( |
| 271 const media::AudioDecoderConfig& config, | 271 const media::AudioDecoderConfig& config, |
| 272 const DecoderInitCB& init_cb) { | 272 const DecoderInitCB& init_cb) { |
| 273 if (!render_task_runner_->BelongsToCurrentThread()) { | 273 if (!render_task_runner_->BelongsToCurrentThread()) { |
| 274 render_task_runner_->PostTask( | 274 render_task_runner_->PostTask( |
| 275 FROM_HERE, base::Bind(&PpapiDecryptor::InitializeAudioDecoder, | 275 FROM_HERE, base::Bind(&PpapiDecryptor::InitializeAudioDecoder, |
| 276 weak_ptr_factory_.GetWeakPtr(), config, init_cb)); | 276 weak_ptr_factory_.GetWeakPtr(), config, init_cb)); |
| 277 return; | 277 return; |
| 278 } | 278 } |
| 279 | 279 |
| 280 DVLOG(2) << __FUNCTION__; | 280 DVLOG(2) << __func__; |
| 281 DCHECK(config.is_encrypted()); | 281 DCHECK(config.is_encrypted()); |
| 282 DCHECK(config.IsValidConfig()); | 282 DCHECK(config.IsValidConfig()); |
| 283 | 283 |
| 284 audio_decoder_init_cb_ = init_cb; | 284 audio_decoder_init_cb_ = init_cb; |
| 285 if (!CdmDelegate() || | 285 if (!CdmDelegate() || |
| 286 !CdmDelegate()->InitializeAudioDecoder( | 286 !CdmDelegate()->InitializeAudioDecoder( |
| 287 config, base::Bind(&PpapiDecryptor::OnDecoderInitialized, | 287 config, base::Bind(&PpapiDecryptor::OnDecoderInitialized, |
| 288 weak_ptr_factory_.GetWeakPtr(), kAudio))) { | 288 weak_ptr_factory_.GetWeakPtr(), kAudio))) { |
| 289 base::ResetAndReturn(&audio_decoder_init_cb_).Run(false); | 289 base::ResetAndReturn(&audio_decoder_init_cb_).Run(false); |
| 290 return; | 290 return; |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 void PpapiDecryptor::InitializeVideoDecoder( | 294 void PpapiDecryptor::InitializeVideoDecoder( |
| 295 const media::VideoDecoderConfig& config, | 295 const media::VideoDecoderConfig& config, |
| 296 const DecoderInitCB& init_cb) { | 296 const DecoderInitCB& init_cb) { |
| 297 if (!render_task_runner_->BelongsToCurrentThread()) { | 297 if (!render_task_runner_->BelongsToCurrentThread()) { |
| 298 render_task_runner_->PostTask( | 298 render_task_runner_->PostTask( |
| 299 FROM_HERE, base::Bind(&PpapiDecryptor::InitializeVideoDecoder, | 299 FROM_HERE, base::Bind(&PpapiDecryptor::InitializeVideoDecoder, |
| 300 weak_ptr_factory_.GetWeakPtr(), config, init_cb)); | 300 weak_ptr_factory_.GetWeakPtr(), config, init_cb)); |
| 301 return; | 301 return; |
| 302 } | 302 } |
| 303 | 303 |
| 304 DVLOG(2) << __FUNCTION__; | 304 DVLOG(2) << __func__; |
| 305 DCHECK(config.is_encrypted()); | 305 DCHECK(config.is_encrypted()); |
| 306 DCHECK(config.IsValidConfig()); | 306 DCHECK(config.IsValidConfig()); |
| 307 | 307 |
| 308 video_decoder_init_cb_ = init_cb; | 308 video_decoder_init_cb_ = init_cb; |
| 309 if (!CdmDelegate() || | 309 if (!CdmDelegate() || |
| 310 !CdmDelegate()->InitializeVideoDecoder( | 310 !CdmDelegate()->InitializeVideoDecoder( |
| 311 config, base::Bind(&PpapiDecryptor::OnDecoderInitialized, | 311 config, base::Bind(&PpapiDecryptor::OnDecoderInitialized, |
| 312 weak_ptr_factory_.GetWeakPtr(), kVideo))) { | 312 weak_ptr_factory_.GetWeakPtr(), kVideo))) { |
| 313 base::ResetAndReturn(&video_decoder_init_cb_).Run(false); | 313 base::ResetAndReturn(&video_decoder_init_cb_).Run(false); |
| 314 return; | 314 return; |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 void PpapiDecryptor::DecryptAndDecodeAudio( | 318 void PpapiDecryptor::DecryptAndDecodeAudio( |
| 319 const scoped_refptr<media::DecoderBuffer>& encrypted, | 319 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 320 const AudioDecodeCB& audio_decode_cb) { | 320 const AudioDecodeCB& audio_decode_cb) { |
| 321 if (!render_task_runner_->BelongsToCurrentThread()) { | 321 if (!render_task_runner_->BelongsToCurrentThread()) { |
| 322 render_task_runner_->PostTask( | 322 render_task_runner_->PostTask( |
| 323 FROM_HERE, | 323 FROM_HERE, |
| 324 base::Bind(&PpapiDecryptor::DecryptAndDecodeAudio, | 324 base::Bind(&PpapiDecryptor::DecryptAndDecodeAudio, |
| 325 weak_ptr_factory_.GetWeakPtr(), encrypted, audio_decode_cb)); | 325 weak_ptr_factory_.GetWeakPtr(), encrypted, audio_decode_cb)); |
| 326 return; | 326 return; |
| 327 } | 327 } |
| 328 | 328 |
| 329 DVLOG(3) << __FUNCTION__; | 329 DVLOG(3) << __func__; |
| 330 if (!CdmDelegate() || | 330 if (!CdmDelegate() || |
| 331 !CdmDelegate()->DecryptAndDecodeAudio(encrypted, audio_decode_cb)) { | 331 !CdmDelegate()->DecryptAndDecodeAudio(encrypted, audio_decode_cb)) { |
| 332 audio_decode_cb.Run(kError, AudioFrames()); | 332 audio_decode_cb.Run(kError, AudioFrames()); |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 void PpapiDecryptor::DecryptAndDecodeVideo( | 336 void PpapiDecryptor::DecryptAndDecodeVideo( |
| 337 const scoped_refptr<media::DecoderBuffer>& encrypted, | 337 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 338 const VideoDecodeCB& video_decode_cb) { | 338 const VideoDecodeCB& video_decode_cb) { |
| 339 if (!render_task_runner_->BelongsToCurrentThread()) { | 339 if (!render_task_runner_->BelongsToCurrentThread()) { |
| 340 render_task_runner_->PostTask( | 340 render_task_runner_->PostTask( |
| 341 FROM_HERE, | 341 FROM_HERE, |
| 342 base::Bind(&PpapiDecryptor::DecryptAndDecodeVideo, | 342 base::Bind(&PpapiDecryptor::DecryptAndDecodeVideo, |
| 343 weak_ptr_factory_.GetWeakPtr(), encrypted, video_decode_cb)); | 343 weak_ptr_factory_.GetWeakPtr(), encrypted, video_decode_cb)); |
| 344 return; | 344 return; |
| 345 } | 345 } |
| 346 | 346 |
| 347 DVLOG(3) << __FUNCTION__; | 347 DVLOG(3) << __func__; |
| 348 if (!CdmDelegate() || | 348 if (!CdmDelegate() || |
| 349 !CdmDelegate()->DecryptAndDecodeVideo(encrypted, video_decode_cb)) { | 349 !CdmDelegate()->DecryptAndDecodeVideo(encrypted, video_decode_cb)) { |
| 350 video_decode_cb.Run(kError, NULL); | 350 video_decode_cb.Run(kError, NULL); |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 | 353 |
| 354 void PpapiDecryptor::ResetDecoder(StreamType stream_type) { | 354 void PpapiDecryptor::ResetDecoder(StreamType stream_type) { |
| 355 if (!render_task_runner_->BelongsToCurrentThread()) { | 355 if (!render_task_runner_->BelongsToCurrentThread()) { |
| 356 render_task_runner_->PostTask( | 356 render_task_runner_->PostTask( |
| 357 FROM_HERE, base::Bind(&PpapiDecryptor::ResetDecoder, | 357 FROM_HERE, base::Bind(&PpapiDecryptor::ResetDecoder, |
| 358 weak_ptr_factory_.GetWeakPtr(), stream_type)); | 358 weak_ptr_factory_.GetWeakPtr(), stream_type)); |
| 359 return; | 359 return; |
| 360 } | 360 } |
| 361 | 361 |
| 362 DVLOG(2) << __FUNCTION__ << " - stream_type: " << stream_type; | 362 DVLOG(2) << __func__ << " - stream_type: " << stream_type; |
| 363 if (CdmDelegate()) | 363 if (CdmDelegate()) |
| 364 CdmDelegate()->ResetDecoder(stream_type); | 364 CdmDelegate()->ResetDecoder(stream_type); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void PpapiDecryptor::DeinitializeDecoder(StreamType stream_type) { | 367 void PpapiDecryptor::DeinitializeDecoder(StreamType stream_type) { |
| 368 if (!render_task_runner_->BelongsToCurrentThread()) { | 368 if (!render_task_runner_->BelongsToCurrentThread()) { |
| 369 render_task_runner_->PostTask( | 369 render_task_runner_->PostTask( |
| 370 FROM_HERE, base::Bind(&PpapiDecryptor::DeinitializeDecoder, | 370 FROM_HERE, base::Bind(&PpapiDecryptor::DeinitializeDecoder, |
| 371 weak_ptr_factory_.GetWeakPtr(), stream_type)); | 371 weak_ptr_factory_.GetWeakPtr(), stream_type)); |
| 372 return; | 372 return; |
| 373 } | 373 } |
| 374 | 374 |
| 375 DVLOG(2) << __FUNCTION__ << " - stream_type: " << stream_type; | 375 DVLOG(2) << __func__ << " - stream_type: " << stream_type; |
| 376 if (CdmDelegate()) | 376 if (CdmDelegate()) |
| 377 CdmDelegate()->DeinitializeDecoder(stream_type); | 377 CdmDelegate()->DeinitializeDecoder(stream_type); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void PpapiDecryptor::OnDecoderInitialized(StreamType stream_type, | 380 void PpapiDecryptor::OnDecoderInitialized(StreamType stream_type, |
| 381 bool success) { | 381 bool success) { |
| 382 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 382 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 383 switch (stream_type) { | 383 switch (stream_type) { |
| 384 case kAudio: | 384 case kAudio: |
| 385 DCHECK(!audio_decoder_init_cb_.is_null()); | 385 DCHECK(!audio_decoder_init_cb_.is_null()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 399 const std::vector<uint8_t>& message, | 399 const std::vector<uint8_t>& message, |
| 400 const GURL& legacy_destination_url) { | 400 const GURL& legacy_destination_url) { |
| 401 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 401 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 402 session_message_cb_.Run(session_id, message_type, message, | 402 session_message_cb_.Run(session_id, message_type, message, |
| 403 legacy_destination_url); | 403 legacy_destination_url); |
| 404 } | 404 } |
| 405 | 405 |
| 406 void PpapiDecryptor::OnSessionKeysChange(const std::string& session_id, | 406 void PpapiDecryptor::OnSessionKeysChange(const std::string& session_id, |
| 407 bool has_additional_usable_key, | 407 bool has_additional_usable_key, |
| 408 media::CdmKeysInfo keys_info) { | 408 media::CdmKeysInfo keys_info) { |
| 409 DVLOG(2) << __FUNCTION__ << ": " << has_additional_usable_key; | 409 DVLOG(2) << __func__ << ": " << has_additional_usable_key; |
| 410 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 410 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 411 | 411 |
| 412 // TODO(jrummell): Handling resume playback should be done in the media | 412 // TODO(jrummell): Handling resume playback should be done in the media |
| 413 // player, not in the Decryptors. http://crbug.com/413413. | 413 // player, not in the Decryptors. http://crbug.com/413413. |
| 414 if (has_additional_usable_key) | 414 if (has_additional_usable_key) |
| 415 AttemptToResumePlayback(); | 415 AttemptToResumePlayback(); |
| 416 | 416 |
| 417 session_keys_change_cb_.Run(session_id, has_additional_usable_key, | 417 session_keys_change_cb_.Run(session_id, has_additional_usable_key, |
| 418 std::move(keys_info)); | 418 std::move(keys_info)); |
| 419 } | 419 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 452 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 453 pepper_cdm_wrapper_.reset(); | 453 pepper_cdm_wrapper_.reset(); |
| 454 } | 454 } |
| 455 | 455 |
| 456 ContentDecryptorDelegate* PpapiDecryptor::CdmDelegate() { | 456 ContentDecryptorDelegate* PpapiDecryptor::CdmDelegate() { |
| 457 DCHECK(render_task_runner_->BelongsToCurrentThread()); | 457 DCHECK(render_task_runner_->BelongsToCurrentThread()); |
| 458 return (pepper_cdm_wrapper_) ? pepper_cdm_wrapper_->GetCdmDelegate() : NULL; | 458 return (pepper_cdm_wrapper_) ? pepper_cdm_wrapper_->GetCdmDelegate() : NULL; |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace content | 461 } // namespace content |
| OLD | NEW |