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

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

Issue 11023004: Update PPP side of Pepper CDM API to support video decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, CQ'ing. 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
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 bool CopyStringToArray(const std::string& str, uint8 (&array)[array_size]) { 336 bool CopyStringToArray(const std::string& str, uint8 (&array)[array_size]) {
337 if (array_size < str.size()) 337 if (array_size < str.size())
338 return false; 338 return false;
339 339
340 memcpy(array, str.data(), str.size()); 340 memcpy(array, str.data(), str.size());
341 return true; 341 return true;
342 } 342 }
343 343
344 // Fills the |block_info| with information from |decrypt_config|, |timestamp| 344 // Fills the |block_info| with information from |decrypt_config|, |timestamp|
345 // and |request_id|. 345 // and |request_id|.
346 // Returns true if |block_info| is successfully filled. Returns false otherwise. 346 // Returns true if |block_info| is successfully filled. Returns false
347 // otherwise.
347 bool MakeEncryptedBlockInfo( 348 bool MakeEncryptedBlockInfo(
348 const media::DecryptConfig& decrypt_config, 349 const media::DecryptConfig& decrypt_config,
349 int64_t timestamp, 350 int64_t timestamp,
350 uint32_t request_id, 351 uint32_t request_id,
351 PP_EncryptedBlockInfo* block_info) { 352 PP_EncryptedBlockInfo* block_info) {
352 DCHECK(block_info); 353 DCHECK(block_info);
353 354
354 // TODO(xhwang): Fix initialization of PP_EncryptedBlockInfo here and 355 // TODO(xhwang): Fix initialization of PP_EncryptedBlockInfo here and
355 // anywhere else. 356 // anywhere else.
356 memset(block_info, 0, sizeof(*block_info)); 357 memset(block_info, 0, sizeof(*block_info));
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 1539
1539 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); 1540 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
1540 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); 1541 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
1541 1542
1542 plugin_decryption_interface_->Decrypt(pp_instance(), 1543 plugin_decryption_interface_->Decrypt(pp_instance(),
1543 encrypted_resource, 1544 encrypted_resource,
1544 &block_info); 1545 &block_info);
1545 return true; 1546 return true;
1546 } 1547 }
1547 1548
1548 bool PluginInstance::DecryptAndDecode( 1549 // Note: this method can be used with an unencrypted frame.
1549 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, 1550 bool PluginInstance::DecryptAndDecodeFrame(
1551 const scoped_refptr<media::DecoderBuffer>& encrypted_frame,
1550 const media::Decryptor::DecryptCB& decrypt_cb) { 1552 const media::Decryptor::DecryptCB& decrypt_cb) {
1551 if (!LoadContentDecryptorInterface()) 1553 if (!LoadContentDecryptorInterface())
1552 return false; 1554 return false;
1553 1555
1554 ScopedPPResource encrypted_resource(MakeBufferResource( 1556 ScopedPPResource encrypted_resource(MakeBufferResource(
1555 pp_instance(), 1557 pp_instance(),
1556 encrypted_buffer->GetData(), 1558 encrypted_frame->GetData(),
1557 encrypted_buffer->GetDataSize())); 1559 encrypted_frame->GetDataSize()));
1558 if (!encrypted_resource.get()) 1560 if (!encrypted_resource.get())
1559 return false; 1561 return false;
1560 1562
1561 PP_EncryptedBlockInfo block_info; 1563 const uint32_t request_id = next_decryption_request_id_++;
1562 1564
1563 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor. 1565 // TODO(tomfinegan): Need to get the video format information here somehow.
1564 plugin_decryption_interface_->DecryptAndDecode(pp_instance(), 1566 PP_EncryptedVideoFrameInfo frame_info;
1565 encrypted_resource, 1567 frame_info.width = 0;
1566 &block_info); 1568 frame_info.height = 0;
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,
1576 &frame_info.encryption_info)) {
1577 return false;
1578 }
1579
1580 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
1581 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
1582
1583 plugin_decryption_interface_->DecryptAndDecodeFrame(pp_instance(),
1584 encrypted_resource,
1585 &frame_info);
1567 return true; 1586 return true;
1568 } 1587 }
1569 1588
1570 bool PluginInstance::FlashIsFullscreenOrPending() { 1589 bool PluginInstance::FlashIsFullscreenOrPending() {
1571 return fullscreen_container_ != NULL; 1590 return fullscreen_container_ != NULL;
1572 } 1591 }
1573 1592
1574 bool PluginInstance::IsFullscreenOrPending() { 1593 bool PluginInstance::IsFullscreenOrPending() {
1575 return desired_fullscreen_state_; 1594 return desired_fullscreen_state_;
1576 } 1595 }
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 screen_size_for_fullscreen_ = gfx::Size(); 2708 screen_size_for_fullscreen_ = gfx::Size();
2690 WebElement element = container_->element(); 2709 WebElement element = container_->element();
2691 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2710 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2692 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2711 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2693 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2712 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2694 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2713 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2695 } 2714 }
2696 2715
2697 } // namespace ppapi 2716 } // namespace ppapi
2698 } // namespace webkit 2717 } // namespace webkit
OLDNEW
« no previous file with comments | « 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