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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 11087044: Generalize Pepper CDM API decrypt and decode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); 1540 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
1541 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); 1541 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
1542 1542
1543 plugin_decryption_interface_->Decrypt(pp_instance(), 1543 plugin_decryption_interface_->Decrypt(pp_instance(),
1544 encrypted_resource, 1544 encrypted_resource,
1545 &block_info); 1545 &block_info);
1546 return true; 1546 return true;
1547 } 1547 }
1548 1548
1549 // Note: this method can be used with an unencrypted frame. 1549 // Note: this method can be used with an unencrypted frame.
1550 bool PluginInstance::DecryptAndDecodeFrame( 1550 bool PluginInstance::DecryptAndDecode(
1551 const scoped_refptr<media::DecoderBuffer>& encrypted_frame, 1551 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
1552 const media::Decryptor::DecryptCB& decrypt_cb) { 1552 const media::Decryptor::DecryptCB& decrypt_cb) {
1553 if (!LoadContentDecryptorInterface()) 1553 if (!LoadContentDecryptorInterface())
1554 return false; 1554 return false;
1555 1555
1556 ScopedPPResource encrypted_resource(MakeBufferResource( 1556 ScopedPPResource encrypted_resource(MakeBufferResource(
1557 pp_instance(), 1557 pp_instance(),
1558 encrypted_frame->GetData(), 1558 encrypted_buffer->GetData(),
1559 encrypted_frame->GetDataSize())); 1559 encrypted_buffer->GetDataSize()));
1560 if (!encrypted_resource.get()) 1560 if (!encrypted_resource.get())
1561 return false; 1561 return false;
1562 1562
1563 const uint32_t request_id = next_decryption_request_id_++; 1563 const uint32_t request_id = next_decryption_request_id_++;
1564 1564
1565 // TODO(tomfinegan): Need to get the video format information here somehow. 1565 PP_EncryptedBlockInfo block_info;
1566 PP_EncryptedVideoFrameInfo frame_info; 1566 DCHECK(encrypted_buffer->GetDecryptConfig());
1567 frame_info.width = 0; 1567 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(),
1568 frame_info.height = 0; 1568 encrypted_buffer->GetTimestamp().InMicroseconds(),
1569 frame_info.format = PP_DECRYPTEDFRAMEFORMAT_UNKNOWN;
1570 frame_info.codec = PP_VIDEOCODEC_UNKNOWN;
1571
1572 DCHECK(encrypted_frame->GetDecryptConfig());
1573 if (!MakeEncryptedBlockInfo(*encrypted_frame->GetDecryptConfig(),
1574 encrypted_frame->GetTimestamp().InMicroseconds(),
1575 request_id, 1569 request_id,
1576 &frame_info.encryption_info)) { 1570 &block_info)) {
1577 return false; 1571 return false;
1578 } 1572 }
1579 1573
1580 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); 1574 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
1581 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); 1575 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
1582 1576
1583 plugin_decryption_interface_->DecryptAndDecodeFrame(pp_instance(), 1577 // TODO(tomfinegan): Need to get stream type from media stack.
xhwang 2012/10/10 23:52:33 Yep, I'll also do the same (stream type) in Decryp
1584 encrypted_resource, 1578 plugin_decryption_interface_->DecryptAndDecode(pp_instance(),
1585 &frame_info); 1579 PP_STREAMTYPE_VIDEO,
1580 encrypted_resource,
1581 &block_info);
1586 return true; 1582 return true;
1587 } 1583 }
1588 1584
1589 bool PluginInstance::FlashIsFullscreenOrPending() { 1585 bool PluginInstance::FlashIsFullscreenOrPending() {
1590 return fullscreen_container_ != NULL; 1586 return fullscreen_container_ != NULL;
1591 } 1587 }
1592 1588
1593 bool PluginInstance::IsFullscreenOrPending() { 1589 bool PluginInstance::IsFullscreenOrPending() {
1594 return desired_fullscreen_state_; 1590 return desired_fullscreen_state_;
1595 } 1591 }
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2708 screen_size_for_fullscreen_ = gfx::Size(); 2704 screen_size_for_fullscreen_ = gfx::Size();
2709 WebElement element = container_->element(); 2705 WebElement element = container_->element();
2710 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2706 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2711 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2707 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2712 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2708 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2713 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2709 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2714 } 2710 }
2715 2711
2716 } // namespace ppapi 2712 } // namespace ppapi
2717 } // namespace webkit 2713 } // namespace webkit
OLDNEW
« ppapi/proxy/ppapi_messages.h ('K') | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698