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

Unified Diff: content/renderer/pepper/pepper_video_decoder_host.cc

Issue 1207043002: Introduce a client minimum picture pool size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved constant to shared header, validate min_picture_size now in resource proxy as well as host co… Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/pepper_video_decoder_host.h ('k') | content/renderer/pepper/video_decoder_shim.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d97aed8be2e70c314b38573fa7dcd2c70cce1ddc..c3851a46912d55cfad621d8f29eaad3a9ce5e223 100644
--- a/content/renderer/pepper/pepper_video_decoder_host.cc
+++ b/content/renderer/pepper/pepper_video_decoder_host.cc
@@ -8,11 +8,14 @@
#include "base/memory/shared_memory.h"
#include "content/common/gpu/client/command_buffer_proxy_impl.h"
#include "content/common/pepper_file_util.h"
+#include "content/public/common/content_client.h"
+#include "content/public/renderer/content_renderer_client.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/renderer_ppapi_host.h"
#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 +84,7 @@ PepperVideoDecoderHost::PepperVideoDecoderHost(RendererPpapiHost* host,
PP_Resource resource)
: ResourceHost(host->GetPpapiHost(), instance, resource),
renderer_ppapi_host_(host),
+ min_picture_count_(0),
initialized_(false) {
}
@@ -113,9 +117,12 @@ 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;
+ if (min_picture_count > ppapi::proxy::kMaximumPictureCount)
+ return PP_ERROR_BADARGUMENT;
EnterResourceNoLock<PPB_Graphics3D_API> enter_graphics(
graphics_context.host_resource(), true);
@@ -130,6 +137,17 @@ int32_t PepperVideoDecoderHost::OnHostMsgInitialize(
media::VideoCodecProfile media_profile = PepperToMediaVideoProfile(profile);
+ // Check for Dev API use
+ // TODO(lpique): remove check when PPB_VideoDecoder_1_1 reaches beta/stable.
+ // https://crbug.com/520323
+ if (min_picture_count != 0) {
+ ContentRendererClient* client = GetContentClient()->renderer();
+ bool allowed = client->IsPluginAllowedToUseDevChannelAPIs();
+ if (!allowed)
+ return PP_ERROR_NOTSUPPORTED;
+ }
+ 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.
@@ -146,7 +164,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);
@@ -317,7 +338,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>());
« no previous file with comments | « content/renderer/pepper/pepper_video_decoder_host.h ('k') | content/renderer/pepper/video_decoder_shim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698