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

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: 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_EncryptedMediaInfo media_info;
1566 PP_EncryptedVideoFrameInfo frame_info;
1567 frame_info.width = 0;
1568 frame_info.height = 0;
1569 frame_info.format = PP_DECRYPTEDFRAMEFORMAT_UNKNOWN;
1570 frame_info.codec = PP_VIDEOCODEC_UNKNOWN;
1571 1566
1572 DCHECK(encrypted_frame->GetDecryptConfig()); 1567 // TODO(tomfinegan): Need to get |media_type| from media stack.
1573 if (!MakeEncryptedBlockInfo(*encrypted_frame->GetDecryptConfig(), 1568 media_info.media_type = PP_STREAMTYPE_UNKNOWN;
Ami GONE FROM CHROMIUM 2012/10/10 07:30:26 shouldn't this be VIDEO until AUDIO support is add
Tom Finegan 2012/10/10 08:26:06 Done.
1574 encrypted_frame->GetTimestamp().InMicroseconds(), 1569
1570
1571 DCHECK(encrypted_buffer->GetDecryptConfig());
1572 if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(),
1573 encrypted_buffer->GetTimestamp().InMicroseconds(),
1575 request_id, 1574 request_id,
1576 &frame_info.encryption_info)) { 1575 &media_info.encryption_info)) {
1577 return false; 1576 return false;
1578 } 1577 }
1579 1578
1580 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id)); 1579 DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
1581 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb)); 1580 pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
1582 1581
1583 plugin_decryption_interface_->DecryptAndDecodeFrame(pp_instance(), 1582 plugin_decryption_interface_->DecryptAndDecode(pp_instance(),
1584 encrypted_resource, 1583 encrypted_resource,
1585 &frame_info); 1584 &media_info);
1586 return true; 1585 return true;
1587 } 1586 }
1588 1587
1589 bool PluginInstance::FlashIsFullscreenOrPending() { 1588 bool PluginInstance::FlashIsFullscreenOrPending() {
1590 return fullscreen_container_ != NULL; 1589 return fullscreen_container_ != NULL;
1591 } 1590 }
1592 1591
1593 bool PluginInstance::IsFullscreenOrPending() { 1592 bool PluginInstance::IsFullscreenOrPending() {
1594 return desired_fullscreen_state_; 1593 return desired_fullscreen_state_;
1595 } 1594 }
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2708 screen_size_for_fullscreen_ = gfx::Size(); 2707 screen_size_for_fullscreen_ = gfx::Size();
2709 WebElement element = container_->element(); 2708 WebElement element = container_->element();
2710 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2709 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2711 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2710 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2712 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2711 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2713 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2712 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2714 } 2713 }
2715 2714
2716 } // namespace ppapi 2715 } // namespace ppapi
2717 } // namespace webkit 2716 } // namespace webkit
OLDNEW
« webkit/media/crypto/ppapi/cdm_wrapper.cc ('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