Commit 2097a5e3 authored by xhwang@chromium.org's avatar xhwang@chromium.org

Encrypted Media: Support natural size in video decrypt-and-decode path.

BUG=163755
TEST=EncryptedMediaTest.FrameChangeVideo in content_browsertests using externalclearkey.

Review URL: https://codereview.chromium.org/11414226

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170995 0039d316-1c4b-4281-b951-d872f2087c98
parent 9fb965f1
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "ppapi/shared_impl/var_tracker.h" #include "ppapi/shared_impl/var_tracker.h"
#include "ppapi/thunk/enter.h" #include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_buffer_api.h" #include "ppapi/thunk/ppb_buffer_api.h"
#include "ui/gfx/rect.h"
#include "webkit/plugins/ppapi/ppb_buffer_impl.h" #include "webkit/plugins/ppapi/ppb_buffer_impl.h"
using ppapi::PpapiGlobals; using ppapi::PpapiGlobals;
...@@ -475,6 +476,8 @@ bool ContentDecryptorDelegate::InitializeVideoDecoder( ...@@ -475,6 +476,8 @@ bool ContentDecryptorDelegate::InitializeVideoDecoder(
pending_video_decoder_init_request_id_ = pp_decoder_config.request_id; pending_video_decoder_init_request_id_ = pp_decoder_config.request_id;
pending_video_decoder_init_cb_ = init_cb; pending_video_decoder_init_cb_ = init_cb;
natural_size_ = decoder_config.natural_size();
plugin_decryption_interface_->InitializeVideoDecoder(pp_instance_, plugin_decryption_interface_->InitializeVideoDecoder(pp_instance_,
&pp_decoder_config, &pp_decoder_config,
extra_data_resource); extra_data_resource);
...@@ -486,6 +489,8 @@ bool ContentDecryptorDelegate::DeinitializeDecoder( ...@@ -486,6 +489,8 @@ bool ContentDecryptorDelegate::DeinitializeDecoder(
media::Decryptor::StreamType stream_type) { media::Decryptor::StreamType stream_type) {
CancelDecode(stream_type); CancelDecode(stream_type);
natural_size_ = gfx::Size();
// TODO(tomfinegan): Add decoder deinitialize request tracking, and get // TODO(tomfinegan): Add decoder deinitialize request tracking, and get
// stream type from media stack. // stream type from media stack.
plugin_decryption_interface_->DeinitializeDecoder( plugin_decryption_interface_->DeinitializeDecoder(
...@@ -702,6 +707,9 @@ void ContentDecryptorDelegate::DecoderInitializeDone( ...@@ -702,6 +707,9 @@ void ContentDecryptorDelegate::DecoderInitializeDone(
request_id != pending_video_decoder_init_request_id_) request_id != pending_video_decoder_init_request_id_)
return; return;
if (!success)
natural_size_ = gfx::Size();
DCHECK(!pending_video_decoder_init_cb_.is_null()); DCHECK(!pending_video_decoder_init_cb_.is_null());
pending_video_decoder_init_request_id_ = 0; pending_video_decoder_init_request_id_ = 0;
base::ResetAndReturn( base::ResetAndReturn(
...@@ -828,12 +836,10 @@ void ContentDecryptorDelegate::DeliverFrame( ...@@ -828,12 +836,10 @@ void ContentDecryptorDelegate::DeliverFrame(
gfx::Size frame_size(frame_info->width, frame_info->height); gfx::Size frame_size(frame_info->width, frame_info->height);
DCHECK_EQ(frame_info->format, PP_DECRYPTEDFRAMEFORMAT_YV12); DCHECK_EQ(frame_info->format, PP_DECRYPTEDFRAMEFORMAT_YV12);
// TODO(xhwang): Support visible_rect and natural_size in EME video decoding
// implementations.
scoped_refptr<media::VideoFrame> decoded_frame = scoped_refptr<media::VideoFrame> decoded_frame =
media::VideoFrame::WrapExternalYuvData( media::VideoFrame::WrapExternalYuvData(
media::VideoFrame::YV12, media::VideoFrame::YV12,
frame_size, gfx::Rect(frame_size), frame_size, frame_size, gfx::Rect(frame_size), natural_size_,
frame_info->strides[PP_DECRYPTEDFRAMEPLANES_Y], frame_info->strides[PP_DECRYPTEDFRAMEPLANES_Y],
frame_info->strides[PP_DECRYPTEDFRAMEPLANES_U], frame_info->strides[PP_DECRYPTEDFRAMEPLANES_U],
frame_info->strides[PP_DECRYPTEDFRAMEPLANES_V], frame_info->strides[PP_DECRYPTEDFRAMEPLANES_V],
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "ppapi/c/private/pp_content_decryptor.h" #include "ppapi/c/private/pp_content_decryptor.h"
#include "ppapi/c/private/ppp_content_decryptor_private.h" #include "ppapi/c/private/ppp_content_decryptor_private.h"
#include "ppapi/shared_impl/scoped_pp_resource.h" #include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ui/gfx/size.h"
#include "webkit/plugins/webkit_plugins_export.h" #include "webkit/plugins/webkit_plugins_export.h"
namespace media { namespace media {
...@@ -115,6 +116,8 @@ class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate { ...@@ -115,6 +116,8 @@ class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate {
media::DecryptorClient* decryptor_client_; media::DecryptorClient* decryptor_client_;
gfx::Size natural_size_;
// Request ID for tracking pending content decryption callbacks. // Request ID for tracking pending content decryption callbacks.
// Note that zero indicates an invalid request ID. // Note that zero indicates an invalid request ID.
// TODO(xhwang): Add completion callbacks for Reset/Stop and remove the use // TODO(xhwang): Add completion callbacks for Reset/Stop and remove the use
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment