Chromium Code Reviews| Index: ppapi/proxy/video_decoder_resource.cc |
| diff --git a/ppapi/proxy/video_decoder_resource.cc b/ppapi/proxy/video_decoder_resource.cc |
| index bcc0e6e844a8428674bfb6076a1ddcaad397009e..ed4dae0572d41a98b2327038d58aea1024e6513e 100644 |
| --- a/ppapi/proxy/video_decoder_resource.cc |
| +++ b/ppapi/proxy/video_decoder_resource.cc |
| @@ -29,6 +29,15 @@ using ppapi::thunk::PPB_VideoDecoder_API; |
| namespace ppapi { |
| namespace proxy { |
| +namespace { |
| + |
| +// The maximum number of pictures that the client can pass in for |
| +// min_picture_count, just as a sanity check on the argument. |
| +// This should match the constant of the same name in test_video_decoder.cc. |
| +const uint32_t kMaximumPictureCount = 100; |
|
jln (very slow on Chromium)
2015/08/17 21:44:39
What happens if they don't match?
Could you expos
lpique
2015/08/17 23:57:07
The test in test_video_decoder.cc will fail, since
|
| + |
| +} // namespace |
| + |
| VideoDecoderResource::ShmBuffer::ShmBuffer( |
| scoped_ptr<base::SharedMemory> shm_ptr, |
| uint32_t size, |
| @@ -62,6 +71,7 @@ VideoDecoderResource::VideoDecoderResource(Connection connection, |
| PP_Instance instance) |
| : PluginResource(connection, instance), |
| num_decodes_(0), |
| + min_picture_count_(0), |
| get_picture_(NULL), |
| get_picture_0_1_(NULL), |
| gles2_impl_(NULL), |
| @@ -98,6 +108,19 @@ int32_t VideoDecoderResource::Initialize0_1( |
| allow_software_fallback |
| ? PP_HARDWAREACCELERATION_WITHFALLBACK |
| : PP_HARDWAREACCELERATION_ONLY, |
| + 0, |
| + callback); |
| +} |
| + |
| +int32_t VideoDecoderResource::Initialize0_2( |
| + PP_Resource graphics_context, |
| + PP_VideoProfile profile, |
| + PP_HardwareAcceleration acceleration, |
| + scoped_refptr<TrackedCallback> callback) { |
| + return Initialize(graphics_context, |
| + profile, |
| + acceleration, |
| + 0, |
| callback); |
| } |
| @@ -105,16 +128,21 @@ int32_t VideoDecoderResource::Initialize( |
| PP_Resource graphics_context, |
| PP_VideoProfile profile, |
| PP_HardwareAcceleration acceleration, |
| + uint32_t min_picture_count, |
| scoped_refptr<TrackedCallback> callback) { |
| if (initialized_) |
| return PP_ERROR_FAILED; |
| if (profile < 0 || profile > PP_VIDEOPROFILE_MAX) |
| return PP_ERROR_BADARGUMENT; |
| + if (min_picture_count > kMaximumPictureCount) |
|
bbudge
2015/08/19 18:47:05
You could keep this if you move the constant defin
|
| + return PP_ERROR_BADARGUMENT; |
| if (initialize_callback_.get()) |
| return PP_ERROR_INPROGRESS; |
| if (!graphics_context) |
| return PP_ERROR_BADRESOURCE; |
| + min_picture_count_ = min_picture_count; |
| + |
| HostResource host_resource; |
| if (!testing_) { |
| // Create a new Graphics3D resource that can create texture resources to |
| @@ -144,7 +172,7 @@ int32_t VideoDecoderResource::Initialize( |
| Call<PpapiPluginMsg_VideoDecoder_InitializeReply>( |
| RENDERER, |
| PpapiHostMsg_VideoDecoder_Initialize( |
| - host_resource, profile, acceleration), |
| + host_resource, profile, acceleration, min_picture_count), |
| base::Bind(&VideoDecoderResource::OnPluginMsgInitializeComplete, this)); |
| return PP_OK_COMPLETIONPENDING; |
| @@ -359,6 +387,7 @@ void VideoDecoderResource::OnPluginMsgRequestTextures( |
| uint32_t texture_target, |
| const std::vector<gpu::Mailbox>& mailboxes) { |
| DCHECK(num_textures); |
| + DCHECK(num_textures >= min_picture_count_); |
|
jln (very slow on Chromium)
2015/08/17 21:44:39
Is this correct as a DCHECK? What happens if an at
lpique
2015/08/17 23:57:07
I think so. With the rest of my changes, this shou
bbudge
2015/08/18 00:48:13
You definitely have to validate anything you recei
bbudge
2015/08/19 18:47:06
The DCHECKs here are OK for validating proxy corre
|
| DCHECK(mailboxes.empty() || mailboxes.size() == num_textures); |
| std::vector<uint32_t> texture_ids(num_textures); |
| if (gles2_impl_) { |