Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: webkit/media/crypto/ppapi/cdm_wrapper.cc

Issue 11106004: Allow null buffer resources to be returned through the PPB_ContentDecryptor_Private proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <cstring> 5 #include <cstring>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/logging.h"
11 #include "ppapi/c/pp_errors.h" 12 #include "ppapi/c/pp_errors.h"
12 #include "ppapi/c/pp_stdint.h" 13 #include "ppapi/c/pp_stdint.h"
13 #include "ppapi/c/private/pp_content_decryptor.h" 14 #include "ppapi/c/private/pp_content_decryptor.h"
14 #include "ppapi/cpp/completion_callback.h" 15 #include "ppapi/cpp/completion_callback.h"
15 #include "ppapi/cpp/core.h" 16 #include "ppapi/cpp/core.h"
16 #include "ppapi/cpp/instance.h" 17 #include "ppapi/cpp/instance.h"
17 #include "ppapi/cpp/logging.h" 18 #include "ppapi/cpp/logging.h"
18 #include "ppapi/cpp/module.h" 19 #include "ppapi/cpp/module.h"
19 #include "ppapi/cpp/pass_ref.h" 20 #include "ppapi/cpp/pass_ref.h"
20 #include "ppapi/cpp/resource.h" 21 #include "ppapi/cpp/resource.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 pp::ContentDecryptor_Private::KeyError(key_system_, 614 pp::ContentDecryptor_Private::KeyError(key_system_,
614 session_id, 615 session_id,
615 kUnknownError, 616 kUnknownError,
616 0); 617 0);
617 } 618 }
618 619
619 void CdmWrapper::DeliverBlock(int32_t result, 620 void CdmWrapper::DeliverBlock(int32_t result,
620 const cdm::Status& status, 621 const cdm::Status& status,
621 const LinkedDecryptedBlock& decrypted_block, 622 const LinkedDecryptedBlock& decrypted_block,
622 const PP_DecryptTrackingInfo& tracking_info) { 623 const PP_DecryptTrackingInfo& tracking_info) {
624 DVLOG(2) << "DeliverBlock() - status " << status;
Tom Finegan 2012/10/11 23:57:56 This is going to cause link failures on windows bu
xhwang 2012/10/12 00:06:44 Yeah, I think we are trying to remove dependency o
ddorwin 2012/10/12 00:21:16 Done.
ddorwin 2012/10/12 00:21:16 Done.
625
623 PP_DCHECK(result == PP_OK); 626 PP_DCHECK(result == PP_OK);
624 PP_DecryptedBlockInfo decrypted_block_info; 627 PP_DecryptedBlockInfo decrypted_block_info;
625 decrypted_block_info.tracking_info = tracking_info; 628 decrypted_block_info.tracking_info = tracking_info;
626 decrypted_block_info.tracking_info.timestamp = decrypted_block->timestamp(); 629 decrypted_block_info.tracking_info.timestamp = decrypted_block->timestamp();
627 630
628 switch (status) { 631 switch (status) {
629 case cdm::kSuccess: 632 case cdm::kSuccess:
630 decrypted_block_info.result = PP_DECRYPTRESULT_SUCCESS; 633 decrypted_block_info.result = PP_DECRYPTRESULT_SUCCESS;
631 PP_DCHECK(decrypted_block.get() && decrypted_block->buffer()); 634 PP_DCHECK(decrypted_block.get() && decrypted_block->buffer());
632 break; 635 break;
633 case cdm::kNoKey: 636 case cdm::kNoKey:
634 decrypted_block_info.result = PP_DECRYPTRESULT_DECRYPT_NOKEY; 637 decrypted_block_info.result = PP_DECRYPTRESULT_DECRYPT_NOKEY;
635 break; 638 break;
636 case cdm::kDecryptError: 639 case cdm::kDecryptError:
637 decrypted_block_info.result = PP_DECRYPTRESULT_DECRYPT_ERROR; 640 decrypted_block_info.result = PP_DECRYPTRESULT_DECRYPT_ERROR;
638 break; 641 break;
639 default: 642 default:
640 PP_DCHECK(false); 643 PP_DCHECK(false);
641 decrypted_block_info.result = PP_DECRYPTRESULT_DECRYPT_ERROR; 644 decrypted_block_info.result = PP_DECRYPTRESULT_DECRYPT_ERROR;
642 } 645 }
643 646
644 const pp::Buffer_Dev& buffer = 647 const pp::Buffer_Dev& buffer =
645 decrypted_block.get() && decrypted_block->buffer() ? 648 decrypted_block.get() && decrypted_block->buffer() ?
646 static_cast<PpbBuffer*>(decrypted_block->buffer())->buffer_dev() : 649 static_cast<PpbBuffer*>(decrypted_block->buffer())->buffer_dev() :
647 pp::Buffer_Dev(); 650 pp::Buffer_Dev();
648 651
649 pp::ContentDecryptor_Private::DeliverBlock(buffer, decrypted_block_info); 652 pp::ContentDecryptor_Private::DeliverBlock(buffer, decrypted_block_info);
650 } 653 }
651 654
652 void CdmWrapper::DeliverFrame( 655 void CdmWrapper::DeliverFrame(
653 int32_t result, 656 int32_t result,
654 const cdm::Status& status, 657 const cdm::Status& status,
655 const LinkedVideoFrame& video_frame, 658 const LinkedVideoFrame& video_frame,
656 const PP_DecryptTrackingInfo& tracking_info) { 659 const PP_DecryptTrackingInfo& tracking_info) {
660 DVLOG(2) << "DeliverFrame() - status " << status;
Tom Finegan 2012/10/11 23:57:56 Ditto.
ddorwin 2012/10/12 00:21:16 Done.
657 PP_DCHECK(result == PP_OK); 661 PP_DCHECK(result == PP_OK);
658 PP_DecryptedFrameInfo decrypted_frame_info; 662 PP_DecryptedFrameInfo decrypted_frame_info;
659 decrypted_frame_info.tracking_info = tracking_info; 663 decrypted_frame_info.tracking_info = tracking_info;
660 664
661 switch (status) { 665 switch (status) {
662 case cdm::kSuccess: 666 case cdm::kSuccess:
663 PP_DCHECK(video_frame->format() == cdm::kI420 || 667 PP_DCHECK(video_frame->format() == cdm::kI420 ||
664 video_frame->format() == cdm::kYv12); 668 video_frame->format() == cdm::kYv12);
665 PP_DCHECK(video_frame.get() && video_frame->frame_buffer()); 669 PP_DCHECK(video_frame.get() && video_frame->frame_buffer());
666 decrypted_frame_info.result = PP_DECRYPTRESULT_SUCCESS; 670 decrypted_frame_info.result = PP_DECRYPTRESULT_SUCCESS;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 } // namespace webkit_media 722 } // namespace webkit_media
719 723
720 namespace pp { 724 namespace pp {
721 725
722 // Factory function for your specialization of the Module object. 726 // Factory function for your specialization of the Module object.
723 Module* CreateModule() { 727 Module* CreateModule() {
724 return new webkit_media::CdmWrapperModule(); 728 return new webkit_media::CdmWrapperModule();
725 } 729 }
726 730
727 } // namespace pp 731 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698