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/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "content/renderer/pepper/content_decryptor_delegate.h" | 13 #include "content/renderer/pepper/content_decryptor_delegate.h" |
14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
15 #include "media/base/audio_decoder_config.h" | 15 #include "media/base/audio_decoder_config.h" |
| 16 #include "media/base/cdm_key_information.h" |
16 #include "media/base/data_buffer.h" | 17 #include "media/base/data_buffer.h" |
17 #include "media/base/decoder_buffer.h" | 18 #include "media/base/decoder_buffer.h" |
18 #include "media/base/key_systems.h" | 19 #include "media/base/key_systems.h" |
19 #include "media/base/video_decoder_config.h" | 20 #include "media/base/video_decoder_config.h" |
20 #include "media/base/video_frame.h" | 21 #include "media/base/video_frame.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 scoped_ptr<PpapiDecryptor> PpapiDecryptor::Create( | 25 scoped_ptr<PpapiDecryptor> PpapiDecryptor::Create( |
25 const std::string& key_system, | 26 const std::string& key_system, |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } | 387 } |
387 } | 388 } |
388 | 389 |
389 void PpapiDecryptor::OnSessionMessage(const std::string& web_session_id, | 390 void PpapiDecryptor::OnSessionMessage(const std::string& web_session_id, |
390 const std::vector<uint8>& message, | 391 const std::vector<uint8>& message, |
391 const GURL& destination_url) { | 392 const GURL& destination_url) { |
392 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 393 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
393 session_message_cb_.Run(web_session_id, message, destination_url); | 394 session_message_cb_.Run(web_session_id, message, destination_url); |
394 } | 395 } |
395 | 396 |
396 void PpapiDecryptor::OnSessionKeysChange(const std::string& web_session_id, | 397 void PpapiDecryptor::OnSessionKeysChange( |
397 bool has_additional_usable_key) { | 398 const std::string& web_session_id, |
| 399 bool has_additional_usable_key, |
| 400 const media::CdmKeyInformationVector& key_information) { |
398 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 401 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
399 | 402 |
400 // TODO(jrummell): Handling resume playback should be done in the media | 403 // TODO(jrummell): Handling resume playback should be done in the media |
401 // player, not in the Decryptors. http://crbug.com/413413. | 404 // player, not in the Decryptors. http://crbug.com/413413. |
402 if (has_additional_usable_key) | 405 if (has_additional_usable_key) |
403 AttemptToResumePlayback(); | 406 AttemptToResumePlayback(); |
404 | 407 |
405 session_keys_change_cb_.Run(web_session_id, has_additional_usable_key); | 408 session_keys_change_cb_.Run(web_session_id, has_additional_usable_key, |
| 409 key_information); |
406 } | 410 } |
407 | 411 |
408 void PpapiDecryptor::OnSessionExpirationUpdate( | 412 void PpapiDecryptor::OnSessionExpirationUpdate( |
409 const std::string& web_session_id, | 413 const std::string& web_session_id, |
410 const base::Time& new_expiry_time) { | 414 const base::Time& new_expiry_time) { |
411 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 415 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
412 session_expiration_update_cb_.Run(web_session_id, new_expiry_time); | 416 session_expiration_update_cb_.Run(web_session_id, new_expiry_time); |
413 } | 417 } |
414 | 418 |
415 void PpapiDecryptor::OnSessionClosed(const std::string& web_session_id) { | 419 void PpapiDecryptor::OnSessionClosed(const std::string& web_session_id) { |
(...skipping 22 matching lines...) Expand all Loading... |
438 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 442 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
439 pepper_cdm_wrapper_.reset(); | 443 pepper_cdm_wrapper_.reset(); |
440 } | 444 } |
441 | 445 |
442 ContentDecryptorDelegate* PpapiDecryptor::CdmDelegate() { | 446 ContentDecryptorDelegate* PpapiDecryptor::CdmDelegate() { |
443 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 447 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
444 return (pepper_cdm_wrapper_) ? pepper_cdm_wrapper_->GetCdmDelegate() : NULL; | 448 return (pepper_cdm_wrapper_) ? pepper_cdm_wrapper_->GetCdmDelegate() : NULL; |
445 } | 449 } |
446 | 450 |
447 } // namespace content | 451 } // namespace content |
OLD | NEW |