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 "ppapi/proxy/ppp_content_decryptor_private_proxy.h" | 5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "media/base/limits.h" | 8 #include "media/base/limits.h" |
9 #include "ppapi/c/pp_bool.h" | 9 #include "ppapi/c/pp_bool.h" |
10 #include "ppapi/c/ppb_core.h" | 10 #include "ppapi/c/ppb_core.h" |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, | 681 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, |
682 encrypted_buffer.handle, | 682 encrypted_buffer.handle, |
683 encrypted_buffer.size)); | 683 encrypted_buffer.size)); |
684 if (ppp_decryptor_impl_) { | 684 if (ppp_decryptor_impl_) { |
685 PP_EncryptedBlockInfo block_info; | 685 PP_EncryptedBlockInfo block_info; |
686 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) | 686 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
687 return; | 687 return; |
688 CallWhileUnlocked(ppp_decryptor_impl_->Decrypt, | 688 CallWhileUnlocked(ppp_decryptor_impl_->Decrypt, |
689 instance, | 689 instance, |
690 plugin_resource.get(), | 690 plugin_resource.get(), |
691 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); | 691 &block_info); |
692 } | 692 } |
693 } | 693 } |
694 | 694 |
695 void PPP_ContentDecryptor_Private_Proxy::OnMsgInitializeAudioDecoder( | 695 void PPP_ContentDecryptor_Private_Proxy::OnMsgInitializeAudioDecoder( |
696 PP_Instance instance, | 696 PP_Instance instance, |
697 const std::string& serialized_decoder_config, | 697 const std::string& serialized_decoder_config, |
698 const PPPDecryptor_Buffer& extra_data_buffer) { | 698 const PPPDecryptor_Buffer& extra_data_buffer) { |
699 ScopedPPResource plugin_resource; | 699 ScopedPPResource plugin_resource; |
700 if (extra_data_buffer.size > 0) { | 700 if (extra_data_buffer.size > 0) { |
701 plugin_resource = ScopedPPResource( | 701 plugin_resource = ScopedPPResource( |
702 ScopedPPResource::PassRef(), | 702 ScopedPPResource::PassRef(), |
703 PPB_Buffer_Proxy::AddProxyResource(extra_data_buffer.resource, | 703 PPB_Buffer_Proxy::AddProxyResource(extra_data_buffer.resource, |
704 extra_data_buffer.handle, | 704 extra_data_buffer.handle, |
705 extra_data_buffer.size)); | 705 extra_data_buffer.size)); |
706 } | 706 } |
707 | 707 |
708 PP_AudioDecoderConfig decoder_config; | 708 PP_AudioDecoderConfig decoder_config; |
709 if (!DeserializeBlockInfo(serialized_decoder_config, &decoder_config)) | 709 if (!DeserializeBlockInfo(serialized_decoder_config, &decoder_config)) |
710 return; | 710 return; |
711 | 711 |
712 if (ppp_decryptor_impl_) { | 712 if (ppp_decryptor_impl_) { |
713 CallWhileUnlocked( | 713 CallWhileUnlocked( |
714 ppp_decryptor_impl_->InitializeAudioDecoder, | 714 ppp_decryptor_impl_->InitializeAudioDecoder, |
715 instance, | 715 instance, |
716 const_cast<const PP_AudioDecoderConfig*>(&decoder_config), | 716 &decoder_config, |
717 plugin_resource.get()); | 717 plugin_resource.get()); |
718 } | 718 } |
719 } | 719 } |
720 | 720 |
721 void PPP_ContentDecryptor_Private_Proxy::OnMsgInitializeVideoDecoder( | 721 void PPP_ContentDecryptor_Private_Proxy::OnMsgInitializeVideoDecoder( |
722 PP_Instance instance, | 722 PP_Instance instance, |
723 const std::string& serialized_decoder_config, | 723 const std::string& serialized_decoder_config, |
724 const PPPDecryptor_Buffer& extra_data_buffer) { | 724 const PPPDecryptor_Buffer& extra_data_buffer) { |
725 ScopedPPResource plugin_resource; | 725 ScopedPPResource plugin_resource; |
726 if (extra_data_buffer.resource.host_resource() != 0) { | 726 if (extra_data_buffer.resource.host_resource() != 0) { |
727 plugin_resource = ScopedPPResource( | 727 plugin_resource = ScopedPPResource( |
728 ScopedPPResource::PassRef(), | 728 ScopedPPResource::PassRef(), |
729 PPB_Buffer_Proxy::AddProxyResource(extra_data_buffer.resource, | 729 PPB_Buffer_Proxy::AddProxyResource(extra_data_buffer.resource, |
730 extra_data_buffer.handle, | 730 extra_data_buffer.handle, |
731 extra_data_buffer.size)); | 731 extra_data_buffer.size)); |
732 } | 732 } |
733 | 733 |
734 PP_VideoDecoderConfig decoder_config; | 734 PP_VideoDecoderConfig decoder_config; |
735 if (!DeserializeBlockInfo(serialized_decoder_config, &decoder_config)) | 735 if (!DeserializeBlockInfo(serialized_decoder_config, &decoder_config)) |
736 return; | 736 return; |
737 | 737 |
738 if (ppp_decryptor_impl_) { | 738 if (ppp_decryptor_impl_) { |
739 CallWhileUnlocked( | 739 CallWhileUnlocked( |
740 ppp_decryptor_impl_->InitializeVideoDecoder, | 740 ppp_decryptor_impl_->InitializeVideoDecoder, |
741 instance, | 741 instance, |
742 const_cast<const PP_VideoDecoderConfig*>(&decoder_config), | 742 &decoder_config, |
743 plugin_resource.get()); | 743 plugin_resource.get()); |
744 } | 744 } |
745 } | 745 } |
746 | 746 |
747 void PPP_ContentDecryptor_Private_Proxy::OnMsgDeinitializeDecoder( | 747 void PPP_ContentDecryptor_Private_Proxy::OnMsgDeinitializeDecoder( |
748 PP_Instance instance, | 748 PP_Instance instance, |
749 PP_DecryptorStreamType decoder_type, | 749 PP_DecryptorStreamType decoder_type, |
750 uint32_t request_id) { | 750 uint32_t request_id) { |
751 if (ppp_decryptor_impl_) { | 751 if (ppp_decryptor_impl_) { |
752 CallWhileUnlocked( | 752 CallWhileUnlocked( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 | 786 |
787 if (ppp_decryptor_impl_) { | 787 if (ppp_decryptor_impl_) { |
788 PP_EncryptedBlockInfo block_info; | 788 PP_EncryptedBlockInfo block_info; |
789 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) | 789 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
790 return; | 790 return; |
791 CallWhileUnlocked( | 791 CallWhileUnlocked( |
792 ppp_decryptor_impl_->DecryptAndDecode, | 792 ppp_decryptor_impl_->DecryptAndDecode, |
793 instance, | 793 instance, |
794 decoder_type, | 794 decoder_type, |
795 plugin_resource.get(), | 795 plugin_resource.get(), |
796 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); | 796 &block_info); |
797 } | 797 } |
798 } | 798 } |
799 | 799 |
800 } // namespace proxy | 800 } // namespace proxy |
801 } // namespace ppapi | 801 } // namespace ppapi |
OLD | NEW |