| Index: content/renderer/pepper/pepper_video_decoder_host.cc
|
| diff --git a/content/renderer/pepper/pepper_video_decoder_host.cc b/content/renderer/pepper/pepper_video_decoder_host.cc
|
| index 24becb5151442b7048b24262a4d88b5eba20e887..66d7d8fb9f9913e23b3e0e6877ad444b97e4f1ba 100644
|
| --- a/content/renderer/pepper/pepper_video_decoder_host.cc
|
| +++ b/content/renderer/pepper/pepper_video_decoder_host.cc
|
| @@ -13,6 +13,7 @@
|
| #include "content/renderer/pepper/gfx_conversion.h"
|
| #include "content/renderer/pepper/ppb_graphics_3d_impl.h"
|
| #include "content/renderer/pepper/video_decoder_shim.h"
|
| +#include "media/base/limits.h"
|
| #include "media/video/video_decode_accelerator.h"
|
| #include "ppapi/c/pp_completion_callback.h"
|
| #include "ppapi/c/pp_errors.h"
|
| @@ -81,6 +82,7 @@ PepperVideoDecoderHost::PepperVideoDecoderHost(RendererPpapiHost* host,
|
| PP_Resource resource)
|
| : ResourceHost(host->GetPpapiHost(), instance, resource),
|
| renderer_ppapi_host_(host),
|
| + min_picture_count_(0),
|
| initialized_(false) {
|
| }
|
|
|
| @@ -113,7 +115,8 @@ int32_t PepperVideoDecoderHost::OnHostMsgInitialize(
|
| ppapi::host::HostMessageContext* context,
|
| const ppapi::HostResource& graphics_context,
|
| PP_VideoProfile profile,
|
| - PP_HardwareAcceleration acceleration) {
|
| + PP_HardwareAcceleration acceleration,
|
| + uint32_t min_picture_count) {
|
| if (initialized_)
|
| return PP_ERROR_FAILED;
|
|
|
| @@ -130,13 +133,16 @@ int32_t PepperVideoDecoderHost::OnHostMsgInitialize(
|
|
|
| media::VideoCodecProfile media_profile = PepperToMediaVideoProfile(profile);
|
|
|
| + min_picture_count_ = min_picture_count;
|
| +
|
| if (acceleration != PP_HARDWAREACCELERATION_NONE) {
|
| // This is not synchronous, but subsequent IPC messages will be buffered, so
|
| // it is okay to immediately send IPC messages through the returned channel.
|
| GpuChannelHost* channel = graphics3d->channel();
|
| DCHECK(channel);
|
| decoder_ = channel->CreateVideoDecoder(command_buffer_route_id);
|
| - if (decoder_ && decoder_->Initialize(media_profile, this)) {
|
| + if (decoder_ &&
|
| + decoder_->Initialize(media_profile, this)) {
|
| initialized_ = true;
|
| return PP_OK;
|
| }
|
| @@ -148,7 +154,10 @@ int32_t PepperVideoDecoderHost::OnHostMsgInitialize(
|
| #if defined(OS_ANDROID)
|
| return PP_ERROR_NOTSUPPORTED;
|
| #else
|
| - decoder_.reset(new VideoDecoderShim(this));
|
| + uint32_t shim_texture_pool_size = media::limits::kMaxVideoFrames + 1;
|
| + shim_texture_pool_size = std::max(shim_texture_pool_size,
|
| + min_picture_count_);
|
| + decoder_.reset(new VideoDecoderShim(this, shim_texture_pool_size));
|
| initialize_reply_context_ = context->MakeReplyMessageContext();
|
| decoder_->Initialize(media_profile, this);
|
|
|
| @@ -319,7 +328,7 @@ void PepperVideoDecoderHost::ProvidePictureBuffers(
|
| uint32 requested_num_of_buffers,
|
| const gfx::Size& dimensions,
|
| uint32 texture_target) {
|
| - RequestTextures(requested_num_of_buffers,
|
| + RequestTextures(std::max(min_picture_count_, requested_num_of_buffers),
|
| dimensions,
|
| texture_target,
|
| std::vector<gpu::Mailbox>());
|
|
|