| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(const std::string& web_session_id, |
| 397 bool has_additional_usable_key) { | 398 bool has_additional_usable_key, |
| 399 media::CdmKeysInfo keys_info) { |
| 398 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 400 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 399 | 401 |
| 400 // TODO(jrummell): Handling resume playback should be done in the media | 402 // TODO(jrummell): Handling resume playback should be done in the media |
| 401 // player, not in the Decryptors. http://crbug.com/413413. | 403 // player, not in the Decryptors. http://crbug.com/413413. |
| 402 if (has_additional_usable_key) | 404 if (has_additional_usable_key) |
| 403 AttemptToResumePlayback(); | 405 AttemptToResumePlayback(); |
| 404 | 406 |
| 405 session_keys_change_cb_.Run(web_session_id, has_additional_usable_key); | 407 session_keys_change_cb_.Run(web_session_id, has_additional_usable_key, |
| 408 keys_info.Pass()); |
| 406 } | 409 } |
| 407 | 410 |
| 408 void PpapiDecryptor::OnSessionExpirationUpdate( | 411 void PpapiDecryptor::OnSessionExpirationUpdate( |
| 409 const std::string& web_session_id, | 412 const std::string& web_session_id, |
| 410 const base::Time& new_expiry_time) { | 413 const base::Time& new_expiry_time) { |
| 411 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 414 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 412 session_expiration_update_cb_.Run(web_session_id, new_expiry_time); | 415 session_expiration_update_cb_.Run(web_session_id, new_expiry_time); |
| 413 } | 416 } |
| 414 | 417 |
| 415 void PpapiDecryptor::OnSessionClosed(const std::string& web_session_id) { | 418 void PpapiDecryptor::OnSessionClosed(const std::string& web_session_id) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 438 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 441 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 439 pepper_cdm_wrapper_.reset(); | 442 pepper_cdm_wrapper_.reset(); |
| 440 } | 443 } |
| 441 | 444 |
| 442 ContentDecryptorDelegate* PpapiDecryptor::CdmDelegate() { | 445 ContentDecryptorDelegate* PpapiDecryptor::CdmDelegate() { |
| 443 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 446 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 444 return (pepper_cdm_wrapper_) ? pepper_cdm_wrapper_->GetCdmDelegate() : NULL; | 447 return (pepper_cdm_wrapper_) ? pepper_cdm_wrapper_->GetCdmDelegate() : NULL; |
| 445 } | 448 } |
| 446 | 449 |
| 447 } // namespace content | 450 } // namespace content |
| OLD | NEW |