summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbbudge <bbudge@chromium.org>2014-08-23 15:17:45 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-23 22:18:36 +0000
commit4d6acafdc75e94256ab7c75f2f3e8a46e42bb9ec (patch)
treec992d155554bce6fc4638b9b4eea09693a5673c0
parent878e9535344a864efec4c5137e3b1363f911f378 (diff)
downloadchromium_src-4d6acafdc75e94256ab7c75f2f3e8a46e42bb9ec.zip
chromium_src-4d6acafdc75e94256ab7c75f2f3e8a46e42bb9ec.tar.gz
chromium_src-4d6acafdc75e94256ab7c75f2f3e8a46e42bb9ec.tar.bz2
Pepper: PPB_VideoDecoder software-only mode.
Add 'Initialize' method that takes an enum value to specify hardware acceleration policy. Policies are always, with fallback and only software. BUG=406194 Review URL: https://codereview.chromium.org/496203002 Cr-Commit-Position: refs/heads/master@{#291606}
-rw-r--r--content/renderer/pepper/pepper_video_decoder_host.cc27
-rw-r--r--content/renderer/pepper/pepper_video_decoder_host.h2
-rw-r--r--native_client_sdk/src/examples/api/video_decode/video_decode.cc2
-rw-r--r--ppapi/api/pp_codecs.idl19
-rw-r--r--ppapi/api/ppb_video_decoder.idl31
-rw-r--r--ppapi/c/pp_codecs.h18
-rw-r--r--ppapi/c/pp_macros.h4
-rw-r--r--ppapi/c/ppb_video_decoder.h36
-rw-r--r--ppapi/cpp/video_decoder.cc42
-rw-r--r--ppapi/cpp/video_decoder.h15
-rw-r--r--ppapi/examples/video_decode/video_decode.cc2
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c63
-rw-r--r--ppapi/proxy/ppapi_messages.h3
-rw-r--r--ppapi/proxy/video_decoder_resource.cc17
-rw-r--r--ppapi/proxy/video_decoder_resource.h7
-rw-r--r--ppapi/proxy/video_decoder_resource_unittest.cc17
-rw-r--r--ppapi/tests/test_video_decoder.cc29
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev_channel.h1
-rw-r--r--ppapi/thunk/ppb_video_decoder_api.h8
-rw-r--r--ppapi/thunk/ppb_video_decoder_thunk.cc37
20 files changed, 310 insertions, 70 deletions
diff --git a/content/renderer/pepper/pepper_video_decoder_host.cc b/content/renderer/pepper/pepper_video_decoder_host.cc
index 3f39c94..086c150 100644
--- a/content/renderer/pepper/pepper_video_decoder_host.cc
+++ b/content/renderer/pepper/pepper_video_decoder_host.cc
@@ -111,7 +111,7 @@ int32_t PepperVideoDecoderHost::OnHostMsgInitialize(
ppapi::host::HostMessageContext* context,
const ppapi::HostResource& graphics_context,
PP_VideoProfile profile,
- bool allow_software_fallback) {
+ PP_HardwareAcceleration acceleration) {
if (initialized_)
return PP_ERROR_FAILED;
@@ -128,23 +128,24 @@ int32_t PepperVideoDecoderHost::OnHostMsgInitialize(
media::VideoCodecProfile media_profile = PepperToMediaVideoProfile(profile);
- // 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)) {
- initialized_ = true;
- return PP_OK;
+ 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)) {
+ initialized_ = true;
+ return PP_OK;
+ }
+ decoder_.reset();
+ if (acceleration == PP_HARDWAREACCELERATION_ONLY)
+ return PP_ERROR_NOTSUPPORTED;
}
- decoder_.reset();
#if defined(OS_ANDROID)
return PP_ERROR_NOTSUPPORTED;
#else
- if (!allow_software_fallback)
- return PP_ERROR_NOTSUPPORTED;
-
decoder_.reset(new VideoDecoderShim(this));
initialize_reply_context_ = context->MakeReplyMessageContext();
decoder_->Initialize(media_profile, this);
diff --git a/content/renderer/pepper/pepper_video_decoder_host.h b/content/renderer/pepper/pepper_video_decoder_host.h
index e76f95c..0ee83b2 100644
--- a/content/renderer/pepper/pepper_video_decoder_host.h
+++ b/content/renderer/pepper/pepper_video_decoder_host.h
@@ -70,7 +70,7 @@ class CONTENT_EXPORT PepperVideoDecoderHost
int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context,
const ppapi::HostResource& graphics_context,
PP_VideoProfile profile,
- bool allow_software_fallback);
+ PP_HardwareAcceleration acceleration);
int32_t OnHostMsgGetShm(ppapi::host::HostMessageContext* context,
uint32_t shm_id,
uint32_t shm_size);
diff --git a/native_client_sdk/src/examples/api/video_decode/video_decode.cc b/native_client_sdk/src/examples/api/video_decode/video_decode.cc
index 80088b9..9664c9b 100644
--- a/native_client_sdk/src/examples/api/video_decode/video_decode.cc
+++ b/native_client_sdk/src/examples/api/video_decode/video_decode.cc
@@ -254,7 +254,7 @@ Decoder::Decoder(MyInstance* instance,
assert(!decoder_->is_null());
decoder_->Initialize(graphics_3d,
kBitstreamProfile,
- PP_TRUE /* allow_software_fallback */,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
callback_factory_.NewCallback(&Decoder::InitializeDone));
}
diff --git a/ppapi/api/pp_codecs.idl b/ppapi/api/pp_codecs.idl
index 423db9f..11010fa 100644
--- a/ppapi/api/pp_codecs.idl
+++ b/ppapi/api/pp_codecs.idl
@@ -24,6 +24,25 @@ enum PP_VideoProfile {
};
/**
+ * Hardware acceleration options.
+ */
+enum PP_HardwareAcceleration {
+ /** Create a hardware accelerated resource only. */
+ PP_HARDWAREACCELERATION_ONLY = 0,
+
+ /**
+ * Create a hardware accelerated resource if possible. Otherwise, fall back
+ * to the software implementation.
+ */
+ PP_HARDWAREACCELERATION_WITHFALLBACK = 1,
+
+ /** Create the software implementation only. */
+ PP_HARDWAREACCELERATION_NONE = 2,
+
+ PP_HARDWAREACCELERATION_LAST = PP_HARDWAREACCELERATION_NONE
+};
+
+/**
* Struct describing a decoded video picture. The decoded picture data is stored
* in the GL texture corresponding to |texture_id|. The plugin can determine
* which Decode call generated the picture using |decode_id|.
diff --git a/ppapi/api/ppb_video_decoder.idl b/ppapi/api/ppb_video_decoder.idl
index b450633..58f9e55 100644
--- a/ppapi/api/ppb_video_decoder.idl
+++ b/ppapi/api/ppb_video_decoder.idl
@@ -10,7 +10,8 @@
[generate_thunk]
label Chrome {
- [channel=dev] M36 = 0.1
+ [channel=dev] M36 = 0.1,
+ [channel=dev] M39 = 0.2
};
/**
@@ -90,6 +91,34 @@ interface PPB_VideoDecoder {
[in] PP_CompletionCallback callback);
/**
+ * Initializes a video decoder resource. This should be called after Create()
+ * and before any other functions.
+ *
+ * @param[in] video_decoder A <code>PP_Resource</code> identifying the video
+ * decoder.
+ * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use
+ * during decoding.
+ * @param[in] profile A <code>PP_VideoProfile</code> specifying the video
+ * codec profile.
+ * @param[in] acceleration A <code>PP_HardwareAcceleration</code> specifying
+ * whether to use a hardware accelerated or a software implementation.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion.
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the
+ * requested profile is not supported. In this case, the client may call
+ * Initialize() again with different parameters to find a good configuration.
+ */
+ [version = 0.2]
+ int32_t Initialize(
+ [in] PP_Resource video_decoder,
+ [in] PP_Resource graphics3d_context,
+ [in] PP_VideoProfile profile,
+ [in] PP_HardwareAcceleration acceleration,
+ [in] PP_CompletionCallback callback);
+
+ /**
* Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
* |buffer|. The plugin should wait until the decoder signals completion by
* returning PP_OK or by running |callback| before calling Decode() again.
diff --git a/ppapi/c/pp_codecs.h b/ppapi/c/pp_codecs.h
index 5e5bce7..f10a480 100644
--- a/ppapi/c/pp_codecs.h
+++ b/ppapi/c/pp_codecs.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From pp_codecs.idl modified Mon Jun 30 14:36:36 2014. */
+/* From pp_codecs.idl modified Fri Aug 22 13:39:56 2014. */
#ifndef PPAPI_C_PP_CODECS_H_
#define PPAPI_C_PP_CODECS_H_
@@ -38,6 +38,22 @@ typedef enum {
PP_VIDEOPROFILE_VP9_ANY = 12,
PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9_ANY
} PP_VideoProfile;
+
+/**
+ * Hardware acceleration options.
+ */
+typedef enum {
+ /** Create a hardware accelerated resource only. */
+ PP_HARDWAREACCELERATION_ONLY = 0,
+ /**
+ * Create a hardware accelerated resource if possible. Otherwise, fall back
+ * to the software implementation.
+ */
+ PP_HARDWAREACCELERATION_WITHFALLBACK = 1,
+ /** Create the software implementation only. */
+ PP_HARDWAREACCELERATION_NONE = 2,
+ PP_HARDWAREACCELERATION_LAST = PP_HARDWAREACCELERATION_NONE
+} PP_HardwareAcceleration;
/**
* @}
*/
diff --git a/ppapi/c/pp_macros.h b/ppapi/c/pp_macros.h
index ea355fa..e9e3ca5 100644
--- a/ppapi/c/pp_macros.h
+++ b/ppapi/c/pp_macros.h
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
-/* From pp_macros.idl modified Wed Jun 11 11:38:24 2014. */
+/* From pp_macros.idl modified Fri Jun 6 18:08:58 2014. */
#ifndef PPAPI_C_PP_MACROS_H_
#define PPAPI_C_PP_MACROS_H_
-#define PPAPI_RELEASE 38
+#define PPAPI_RELEASE 39
/**
* @file
diff --git a/ppapi/c/ppb_video_decoder.h b/ppapi/c/ppb_video_decoder.h
index edab7bc..c3ebf8b 100644
--- a/ppapi/c/ppb_video_decoder.h
+++ b/ppapi/c/ppb_video_decoder.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_video_decoder.idl modified Fri Jul 11 18:06:37 2014. */
+/* From ppb_video_decoder.idl modified Fri Aug 22 13:42:35 2014. */
#ifndef PPAPI_C_PPB_VIDEO_DECODER_H_
#define PPAPI_C_PPB_VIDEO_DECODER_H_
@@ -18,6 +18,7 @@
#include "ppapi/c/pp_stdint.h"
#define PPB_VIDEODECODER_INTERFACE_0_1 "PPB_VideoDecoder;0.1" /* dev */
+#define PPB_VIDEODECODER_INTERFACE_0_2 "PPB_VideoDecoder;0.2" /* dev */
/**
* @file
* This file defines the <code>PPB_VideoDecoder</code> interface.
@@ -51,7 +52,7 @@
* Chrome and ChromeOS: aac, h264.
* ChromeOS: mpeg4.
*/
-struct PPB_VideoDecoder_0_1 { /* dev */
+struct PPB_VideoDecoder_0_2 { /* dev */
/**
* Creates a new video decoder resource.
*
@@ -82,9 +83,8 @@ struct PPB_VideoDecoder_0_1 { /* dev */
* during decoding.
* @param[in] profile A <code>PP_VideoProfile</code> specifying the video
* codec profile.
- * @param[in] allow_software_fallback A <code>PP_Bool</code> specifying
- * whether the decoder can fall back to software decoding if a suitable
- * hardware decoder isn't available.
+ * @param[in] acceleration A <code>PP_HardwareAcceleration</code> specifying
+ * whether to use a hardware accelerated or a software implementation.
* @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
* completion.
*
@@ -96,7 +96,7 @@ struct PPB_VideoDecoder_0_1 { /* dev */
int32_t (*Initialize)(PP_Resource video_decoder,
PP_Resource graphics3d_context,
PP_VideoProfile profile,
- PP_Bool allow_software_fallback,
+ PP_HardwareAcceleration acceleration,
struct PP_CompletionCallback callback);
/**
* Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
@@ -214,6 +214,30 @@ struct PPB_VideoDecoder_0_1 { /* dev */
int32_t (*Reset)(PP_Resource video_decoder,
struct PP_CompletionCallback callback);
};
+
+struct PPB_VideoDecoder_0_1 { /* dev */
+ PP_Resource (*Create)(PP_Instance instance);
+ PP_Bool (*IsVideoDecoder)(PP_Resource resource);
+ int32_t (*Initialize)(PP_Resource video_decoder,
+ PP_Resource graphics3d_context,
+ PP_VideoProfile profile,
+ PP_Bool allow_software_fallback,
+ struct PP_CompletionCallback callback);
+ int32_t (*Decode)(PP_Resource video_decoder,
+ uint32_t decode_id,
+ uint32_t size,
+ const void* buffer,
+ struct PP_CompletionCallback callback);
+ int32_t (*GetPicture)(PP_Resource video_decoder,
+ struct PP_VideoPicture* picture,
+ struct PP_CompletionCallback callback);
+ void (*RecyclePicture)(PP_Resource video_decoder,
+ const struct PP_VideoPicture* picture);
+ int32_t (*Flush)(PP_Resource video_decoder,
+ struct PP_CompletionCallback callback);
+ int32_t (*Reset)(PP_Resource video_decoder,
+ struct PP_CompletionCallback callback);
+};
/**
* @}
*/
diff --git a/ppapi/cpp/video_decoder.cc b/ppapi/cpp/video_decoder.cc
index 3277a21..85654c1 100644
--- a/ppapi/cpp/video_decoder.cc
+++ b/ppapi/cpp/video_decoder.cc
@@ -20,6 +20,11 @@ const char* interface_name<PPB_VideoDecoder_0_1>() {
return PPB_VIDEODECODER_INTERFACE_0_1;
}
+template <>
+const char* interface_name<PPB_VideoDecoder_0_2>() {
+ return PPB_VIDEODECODER_INTERFACE_0_2;
+}
+
} // namespace
VideoDecoder::VideoDecoder() {
@@ -37,14 +42,26 @@ VideoDecoder::VideoDecoder(const VideoDecoder& other) : Resource(other) {
int32_t VideoDecoder::Initialize(const Graphics3D& context,
PP_VideoProfile profile,
- bool allow_software_fallback,
+ PP_HardwareAcceleration acceleration,
const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->Initialize(
+ pp_resource(),
+ context.pp_resource(),
+ profile,
+ acceleration,
+ cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
+ if (acceleration == PP_HARDWAREACCELERATION_NONE)
+ return cc.MayForce(PP_ERROR_NOTSUPPORTED);
return get_interface<PPB_VideoDecoder_0_1>()->Initialize(
pp_resource(),
context.pp_resource(),
profile,
- PP_FromBool(allow_software_fallback),
+ acceleration == PP_HARDWAREACCELERATION_WITHFALLBACK
+ ? PP_TRUE
+ : PP_FALSE,
cc.pp_completion_callback());
}
return cc.MayForce(PP_ERROR_NOINTERFACE);
@@ -54,6 +71,10 @@ int32_t VideoDecoder::Decode(uint32_t decode_id,
uint32_t size,
const void* buffer,
const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->Decode(
+ pp_resource(), decode_id, size, buffer, cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
return get_interface<PPB_VideoDecoder_0_1>()->Decode(
pp_resource(), decode_id, size, buffer, cc.pp_completion_callback());
@@ -63,6 +84,10 @@ int32_t VideoDecoder::Decode(uint32_t decode_id,
int32_t VideoDecoder::GetPicture(
const CompletionCallbackWithOutput<PP_VideoPicture>& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->GetPicture(
+ pp_resource(), cc.output(), cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
return get_interface<PPB_VideoDecoder_0_1>()->GetPicture(
pp_resource(), cc.output(), cc.pp_completion_callback());
@@ -71,13 +96,20 @@ int32_t VideoDecoder::GetPicture(
}
void VideoDecoder::RecyclePicture(const PP_VideoPicture& picture) {
- if (has_interface<PPB_VideoDecoder_0_1>()) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ get_interface<PPB_VideoDecoder_0_2>()->RecyclePicture(pp_resource(),
+ &picture);
+ } else if (has_interface<PPB_VideoDecoder_0_1>()) {
get_interface<PPB_VideoDecoder_0_1>()->RecyclePicture(pp_resource(),
&picture);
}
}
int32_t VideoDecoder::Flush(const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->Flush(
+ pp_resource(), cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
return get_interface<PPB_VideoDecoder_0_1>()->Flush(
pp_resource(), cc.pp_completion_callback());
@@ -86,6 +118,10 @@ int32_t VideoDecoder::Flush(const CompletionCallback& cc) {
}
int32_t VideoDecoder::Reset(const CompletionCallback& cc) {
+ if (has_interface<PPB_VideoDecoder_0_2>()) {
+ return get_interface<PPB_VideoDecoder_0_2>()->Reset(
+ pp_resource(), cc.pp_completion_callback());
+ }
if (has_interface<PPB_VideoDecoder_0_1>()) {
return get_interface<PPB_VideoDecoder_0_1>()->Reset(
pp_resource(), cc.pp_completion_callback());
diff --git a/ppapi/cpp/video_decoder.h b/ppapi/cpp/video_decoder.h
index c3a2a7c..cc7267b 100644
--- a/ppapi/cpp/video_decoder.h
+++ b/ppapi/cpp/video_decoder.h
@@ -61,14 +61,13 @@ class VideoDecoder : public Resource {
/// Initializes a video decoder resource. This should be called after Create()
/// and before any other functions.
///
- /// @param[in] video_decoder A <code>PP_Resource</code> identifying the video
- /// decoder.
+ /// @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to
+ /// use during decoding.
/// @param[in] profile A <code>PP_VideoProfile</code> specifying the video
/// codec profile.
- /// @param[in] allow_software_fallback A <code>PP_Bool</code> specifying
- /// whether the decoder can fall back to software decoding if a suitable
- /// hardware decoder isn't available.
- /// @param[in] callback A <code>CompletionCallback</code> to be called on
+ /// @param[in] acceleration A <code>PP_HardwareAcceleration</code> specifying
+ /// whether to use a hardware accelerated or a software implementation.
+ /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
/// completion.
///
/// @return An int32_t containing an error code from <code>pp_errors.h</code>.
@@ -77,7 +76,7 @@ class VideoDecoder : public Resource {
/// Initialize() again with different parameters to find a good configuration.
int32_t Initialize(const Graphics3D& graphics3d_context,
PP_VideoProfile profile,
- bool allow_software_fallback,
+ PP_HardwareAcceleration acceleration,
const CompletionCallback& callback);
/// Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's
@@ -120,8 +119,6 @@ class VideoDecoder : public Resource {
/// When the plugin is finished using the picture, it should return it to the
/// system by calling RecyclePicture().
///
- /// @param[in] video_decoder A <code>PP_Resource</code> identifying the video
- /// decoder.
/// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
/// called on completion, and on success, to hold the picture descriptor.
///
diff --git a/ppapi/examples/video_decode/video_decode.cc b/ppapi/examples/video_decode/video_decode.cc
index ab2cead..acd1869 100644
--- a/ppapi/examples/video_decode/video_decode.cc
+++ b/ppapi/examples/video_decode/video_decode.cc
@@ -255,7 +255,7 @@ Decoder::Decoder(MyInstance* instance,
assert(!decoder_->is_null());
decoder_->Initialize(graphics_3d,
kBitstreamProfile,
- PP_TRUE /* allow_software_fallback */,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
callback_factory_.NewCallback(&Decoder::InitializeDone));
}
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index a742eb6..3c3dd81 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -144,6 +144,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArray_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_0_1;
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_0_2;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Messaging_1_0;
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3;
@@ -1970,6 +1971,50 @@ static int32_t Pnacl_M36_PPB_VideoDecoder_Reset(PP_Resource video_decoder, struc
/* End wrapper methods for PPB_VideoDecoder_0_1 */
+/* Begin wrapper methods for PPB_VideoDecoder_0_2 */
+
+static PP_Resource Pnacl_M39_PPB_VideoDecoder_Create(PP_Instance instance) {
+ const struct PPB_VideoDecoder_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_0_2.real_iface;
+ return iface->Create(instance);
+}
+
+static PP_Bool Pnacl_M39_PPB_VideoDecoder_IsVideoDecoder(PP_Resource resource) {
+ const struct PPB_VideoDecoder_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_0_2.real_iface;
+ return iface->IsVideoDecoder(resource);
+}
+
+static int32_t Pnacl_M39_PPB_VideoDecoder_Initialize(PP_Resource video_decoder, PP_Resource graphics3d_context, PP_VideoProfile profile, PP_HardwareAcceleration acceleration, struct PP_CompletionCallback* callback) {
+ const struct PPB_VideoDecoder_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_0_2.real_iface;
+ return iface->Initialize(video_decoder, graphics3d_context, profile, acceleration, *callback);
+}
+
+static int32_t Pnacl_M39_PPB_VideoDecoder_Decode(PP_Resource video_decoder, uint32_t decode_id, uint32_t size, const void* buffer, struct PP_CompletionCallback* callback) {
+ const struct PPB_VideoDecoder_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_0_2.real_iface;
+ return iface->Decode(video_decoder, decode_id, size, buffer, *callback);
+}
+
+static int32_t Pnacl_M39_PPB_VideoDecoder_GetPicture(PP_Resource video_decoder, struct PP_VideoPicture* picture, struct PP_CompletionCallback* callback) {
+ const struct PPB_VideoDecoder_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_0_2.real_iface;
+ return iface->GetPicture(video_decoder, picture, *callback);
+}
+
+static void Pnacl_M39_PPB_VideoDecoder_RecyclePicture(PP_Resource video_decoder, const struct PP_VideoPicture* picture) {
+ const struct PPB_VideoDecoder_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_0_2.real_iface;
+ iface->RecyclePicture(video_decoder, picture);
+}
+
+static int32_t Pnacl_M39_PPB_VideoDecoder_Flush(PP_Resource video_decoder, struct PP_CompletionCallback* callback) {
+ const struct PPB_VideoDecoder_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_0_2.real_iface;
+ return iface->Flush(video_decoder, *callback);
+}
+
+static int32_t Pnacl_M39_PPB_VideoDecoder_Reset(PP_Resource video_decoder, struct PP_CompletionCallback* callback) {
+ const struct PPB_VideoDecoder_0_2 *iface = Pnacl_WrapperInfo_PPB_VideoDecoder_0_2.real_iface;
+ return iface->Reset(video_decoder, *callback);
+}
+
+/* End wrapper methods for PPB_VideoDecoder_0_2 */
+
/* Not generating wrapper methods for PPB_VideoFrame_0_1 */
/* Not generating wrapper methods for PPB_View_1_0 */
@@ -4904,6 +4949,17 @@ static const struct PPB_VideoDecoder_0_1 Pnacl_Wrappers_PPB_VideoDecoder_0_1 = {
.Reset = (int32_t (*)(PP_Resource video_decoder, struct PP_CompletionCallback callback))&Pnacl_M36_PPB_VideoDecoder_Reset
};
+static const struct PPB_VideoDecoder_0_2 Pnacl_Wrappers_PPB_VideoDecoder_0_2 = {
+ .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M39_PPB_VideoDecoder_Create,
+ .IsVideoDecoder = (PP_Bool (*)(PP_Resource resource))&Pnacl_M39_PPB_VideoDecoder_IsVideoDecoder,
+ .Initialize = (int32_t (*)(PP_Resource video_decoder, PP_Resource graphics3d_context, PP_VideoProfile profile, PP_HardwareAcceleration acceleration, struct PP_CompletionCallback callback))&Pnacl_M39_PPB_VideoDecoder_Initialize,
+ .Decode = (int32_t (*)(PP_Resource video_decoder, uint32_t decode_id, uint32_t size, const void* buffer, struct PP_CompletionCallback callback))&Pnacl_M39_PPB_VideoDecoder_Decode,
+ .GetPicture = (int32_t (*)(PP_Resource video_decoder, struct PP_VideoPicture* picture, struct PP_CompletionCallback callback))&Pnacl_M39_PPB_VideoDecoder_GetPicture,
+ .RecyclePicture = (void (*)(PP_Resource video_decoder, const struct PP_VideoPicture* picture))&Pnacl_M39_PPB_VideoDecoder_RecyclePicture,
+ .Flush = (int32_t (*)(PP_Resource video_decoder, struct PP_CompletionCallback callback))&Pnacl_M39_PPB_VideoDecoder_Flush,
+ .Reset = (int32_t (*)(PP_Resource video_decoder, struct PP_CompletionCallback callback))&Pnacl_M39_PPB_VideoDecoder_Reset
+};
+
/* Not generating wrapper interface for PPB_VideoFrame_0_1 */
/* Not generating wrapper interface for PPB_View_1_0 */
@@ -5894,6 +5950,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_0_1 = {
.real_iface = NULL
};
+static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VideoDecoder_0_2 = {
+ .iface_macro = PPB_VIDEODECODER_INTERFACE_0_2,
+ .wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_VideoDecoder_0_2,
+ .real_iface = NULL
+};
+
static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0 = {
.iface_macro = PPB_WEBSOCKET_INTERFACE_1_0,
.wrapped_iface = (const void *) &Pnacl_Wrappers_PPB_WebSocket_1_0,
@@ -6303,6 +6365,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = {
&Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0,
&Pnacl_WrapperInfo_PPB_VarDictionary_1_0,
&Pnacl_WrapperInfo_PPB_VideoDecoder_0_1,
+ &Pnacl_WrapperInfo_PPB_VideoDecoder_0_2,
&Pnacl_WrapperInfo_PPB_WebSocket_1_0,
&Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3,
&Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4,
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 7747abf..9afdcbc 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -128,6 +128,7 @@ IPC_ENUM_TRAITS_MAX_VALUE(PP_UDPSocket_Option,
IPC_ENUM_TRAITS(PP_VideoDecodeError_Dev)
IPC_ENUM_TRAITS(PP_VideoDecoder_Profile)
IPC_ENUM_TRAITS_MAX_VALUE(PP_VideoFrame_Format, PP_VIDEOFRAME_FORMAT_LAST)
+IPC_ENUM_TRAITS_MAX_VALUE(PP_HardwareAcceleration, PP_HARDWAREACCELERATION_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(PP_VideoProfile, PP_VIDEOPROFILE_MAX)
IPC_STRUCT_TRAITS_BEGIN(PP_Point)
@@ -1900,7 +1901,7 @@ IPC_MESSAGE_CONTROL0(PpapiHostMsg_VideoDecoder_Create)
IPC_MESSAGE_CONTROL3(PpapiHostMsg_VideoDecoder_Initialize,
ppapi::HostResource /* graphics_context */,
PP_VideoProfile /* profile */,
- bool /* allow_software_fallback */)
+ PP_HardwareAcceleration /* acceleration */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_VideoDecoder_InitializeReply)
IPC_MESSAGE_CONTROL2(PpapiHostMsg_VideoDecoder_GetShm,
uint32_t /* shm_id */,
diff --git a/ppapi/proxy/video_decoder_resource.cc b/ppapi/proxy/video_decoder_resource.cc
index 54ccfe7..d430edc 100644
--- a/ppapi/proxy/video_decoder_resource.cc
+++ b/ppapi/proxy/video_decoder_resource.cc
@@ -85,11 +85,24 @@ PPB_VideoDecoder_API* VideoDecoderResource::AsPPB_VideoDecoder_API() {
return this;
}
-int32_t VideoDecoderResource::Initialize(
+int32_t VideoDecoderResource::Initialize0_1(
PP_Resource graphics_context,
PP_VideoProfile profile,
PP_Bool allow_software_fallback,
scoped_refptr<TrackedCallback> callback) {
+ return Initialize(graphics_context,
+ profile,
+ allow_software_fallback
+ ? PP_HARDWAREACCELERATION_WITHFALLBACK
+ : PP_HARDWAREACCELERATION_ONLY,
+ callback);
+}
+
+int32_t VideoDecoderResource::Initialize(
+ PP_Resource graphics_context,
+ PP_VideoProfile profile,
+ PP_HardwareAcceleration acceleration,
+ scoped_refptr<TrackedCallback> callback) {
if (initialized_)
return PP_ERROR_FAILED;
if (profile < 0 || profile > PP_VIDEOPROFILE_MAX)
@@ -128,7 +141,7 @@ int32_t VideoDecoderResource::Initialize(
Call<PpapiPluginMsg_VideoDecoder_InitializeReply>(
RENDERER,
PpapiHostMsg_VideoDecoder_Initialize(
- host_resource, profile, PP_ToBool(allow_software_fallback)),
+ host_resource, profile, acceleration),
base::Bind(&VideoDecoderResource::OnPluginMsgInitializeComplete, this));
return PP_OK_COMPLETIONPENDING;
diff --git a/ppapi/proxy/video_decoder_resource.h b/ppapi/proxy/video_decoder_resource.h
index a466eb2..a9d8e8d 100644
--- a/ppapi/proxy/video_decoder_resource.h
+++ b/ppapi/proxy/video_decoder_resource.h
@@ -43,9 +43,14 @@ class PPAPI_PROXY_EXPORT VideoDecoderResource
virtual thunk::PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE;
// PPB_VideoDecoder_API implementation.
+ virtual int32_t Initialize0_1(
+ PP_Resource graphics_context,
+ PP_VideoProfile profile,
+ PP_Bool allow_software_fallback,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual int32_t Initialize(PP_Resource graphics_context,
PP_VideoProfile profile,
- PP_Bool allow_software_fallback,
+ PP_HardwareAcceleration acceleration,
scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual int32_t Decode(uint32_t decode_id,
uint32_t size,
diff --git a/ppapi/proxy/video_decoder_resource_unittest.cc b/ppapi/proxy/video_decoder_resource_unittest.cc
index b9f0e79..fa6e89f 100644
--- a/ppapi/proxy/video_decoder_resource_unittest.cc
+++ b/ppapi/proxy/video_decoder_resource_unittest.cc
@@ -26,7 +26,6 @@ namespace proxy {
namespace {
-const PP_Bool kAllowSoftwareFallback = PP_TRUE;
const PP_Resource kGraphics3D = 7;
const uint32_t kShmSize = 256;
const size_t kDecodeBufferSize = 16;
@@ -59,9 +58,9 @@ class MockCompletionCallback {
class VideoDecoderResourceTest : public PluginProxyTest {
public:
VideoDecoderResourceTest()
- : decoder_iface_(thunk::GetPPB_VideoDecoder_0_1_Thunk()) {}
+ : decoder_iface_(thunk::GetPPB_VideoDecoder_0_2_Thunk()) {}
- const PPB_VideoDecoder_0_1* decoder_iface() const { return decoder_iface_; }
+ const PPB_VideoDecoder_0_2* decoder_iface() const { return decoder_iface_; }
void SendReply(const ResourceMessageCallParams& params,
int32_t result,
@@ -117,7 +116,7 @@ class VideoDecoderResourceTest : public PluginProxyTest {
decoder,
graphics3d.get(),
PP_VIDEOPROFILE_H264MAIN,
- PP_TRUE /* allow_software_fallback */,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
PP_MakeOptionalCompletionCallback(&MockCompletionCallback::Callback,
&cb));
if (result != PP_OK_COMPLETIONPENDING)
@@ -299,7 +298,7 @@ class VideoDecoderResourceTest : public PluginProxyTest {
return true;
}
- const PPB_VideoDecoder_0_1* decoder_iface_;
+ const PPB_VideoDecoder_0_2* decoder_iface_;
char decode_buffer_[kDecodeBufferSize];
};
@@ -315,7 +314,7 @@ TEST_F(VideoDecoderResourceTest, Initialize) {
decoder.get(),
0 /* invalid 3d graphics */,
PP_VIDEOPROFILE_H264MAIN,
- kAllowSoftwareFallback,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
PP_MakeOptionalCompletionCallback(&MockCompletionCallback::Callback,
&cb));
ASSERT_EQ(PP_ERROR_BADRESOURCE, result);
@@ -328,7 +327,7 @@ TEST_F(VideoDecoderResourceTest, Initialize) {
decoder.get(),
1 /* non-zero resource */,
static_cast<PP_VideoProfile>(-1),
- kAllowSoftwareFallback,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
PP_MakeOptionalCompletionCallback(&MockCompletionCallback::Callback,
&cb));
ASSERT_EQ(PP_ERROR_BADARGUMENT, result);
@@ -342,7 +341,7 @@ TEST_F(VideoDecoderResourceTest, Initialize) {
decoder.get(),
graphics3d.get(),
PP_VIDEOPROFILE_H264MAIN,
- kAllowSoftwareFallback,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
PP_MakeOptionalCompletionCallback(&MockCompletionCallback::Callback,
&cb));
ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
@@ -353,7 +352,7 @@ TEST_F(VideoDecoderResourceTest, Initialize) {
decoder.get(),
graphics3d.get(),
PP_VIDEOPROFILE_H264MAIN,
- kAllowSoftwareFallback,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
PP_MakeOptionalCompletionCallback(&MockCompletionCallback::Callback,
&cb));
ASSERT_EQ(PP_ERROR_INPROGRESS, result);
diff --git a/ppapi/tests/test_video_decoder.cc b/ppapi/tests/test_video_decoder.cc
index f5d5bc0..f396bda 100644
--- a/ppapi/tests/test_video_decoder.cc
+++ b/ppapi/tests/test_video_decoder.cc
@@ -11,8 +11,6 @@
REGISTER_TEST_CASE(VideoDecoder);
-static const bool kAllowSoftwareFallback = true;
-
bool TestVideoDecoder::Init() {
video_decoder_interface_ = static_cast<const PPB_VideoDecoder_0_1*>(
pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_INTERFACE_0_1));
@@ -37,10 +35,11 @@ std::string TestVideoDecoder::TestCreate() {
TestCompletionCallback callback(instance_->pp_instance(), callback_type());
pp::Graphics3D null_graphics_3d;
- callback.WaitForResult(video_decoder.Initialize(null_graphics_3d,
- PP_VIDEOPROFILE_VP8_ANY,
- kAllowSoftwareFallback,
- callback.GetCallback()));
+ callback.WaitForResult(
+ video_decoder.Initialize(null_graphics_3d,
+ PP_VIDEOPROFILE_VP8_ANY,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
+ callback.GetCallback()));
ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result());
}
// Test that Initialize fails with a bad profile enum value.
@@ -48,10 +47,11 @@ std::string TestVideoDecoder::TestCreate() {
pp::VideoDecoder video_decoder(instance_);
TestCompletionCallback callback(instance_->pp_instance(), callback_type());
const PP_VideoProfile kInvalidProfile = static_cast<PP_VideoProfile>(-1);
- callback.WaitForResult(video_decoder.Initialize(graphics_3d_,
- kInvalidProfile,
- kAllowSoftwareFallback,
- callback.GetCallback()));
+ callback.WaitForResult(
+ video_decoder.Initialize(graphics_3d_,
+ kInvalidProfile,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
+ callback.GetCallback()));
ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result());
}
// Test that Initialize succeeds if we can create a Graphics3D resources and
@@ -59,10 +59,11 @@ std::string TestVideoDecoder::TestCreate() {
if (!graphics_3d_.is_null()) {
pp::VideoDecoder video_decoder(instance_);
TestCompletionCallback callback(instance_->pp_instance(), callback_type());
- callback.WaitForResult(video_decoder.Initialize(graphics_3d_,
- PP_VIDEOPROFILE_VP8_ANY,
- kAllowSoftwareFallback,
- callback.GetCallback()));
+ callback.WaitForResult(
+ video_decoder.Initialize(graphics_3d_,
+ PP_VIDEOPROFILE_VP8_ANY,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
+ callback.GetCallback()));
ASSERT_EQ(PP_OK, callback.result());
}
diff --git a/ppapi/thunk/interfaces_ppb_public_dev_channel.h b/ppapi/thunk/interfaces_ppb_public_dev_channel.h
index a4f0e59..052ef4b 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev_channel.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev_channel.h
@@ -13,6 +13,7 @@ PROXIED_IFACE(PPB_COMPOSITORLAYER_INTERFACE_0_1, PPB_CompositorLayer_0_1)
PROXIED_IFACE(PPB_FILEMAPPING_INTERFACE_0_1, PPB_FileMapping_0_1)
PROXIED_IFACE(PPB_MESSAGING_INTERFACE_1_1, PPB_Messaging_1_1)
PROXIED_IFACE(PPB_VIDEODECODER_INTERFACE_0_1, PPB_VideoDecoder_0_1)
+PROXIED_IFACE(PPB_VIDEODECODER_INTERFACE_0_2, PPB_VideoDecoder_0_2)
// Note, PPB_TraceEvent is special. We don't want to actually make it stable,
// but we want developers to be able to leverage it when running Chrome Dev or
diff --git a/ppapi/thunk/ppb_video_decoder_api.h b/ppapi/thunk/ppb_video_decoder_api.h
index c40845e..40bd99c 100644
--- a/ppapi/thunk/ppb_video_decoder_api.h
+++ b/ppapi/thunk/ppb_video_decoder_api.h
@@ -19,9 +19,13 @@ class PPAPI_THUNK_EXPORT PPB_VideoDecoder_API {
public:
virtual ~PPB_VideoDecoder_API() {}
- virtual int32_t Initialize(PP_Resource context,
+ virtual int32_t Initialize0_1(PP_Resource graphics3d_context,
+ PP_VideoProfile profile,
+ PP_Bool allow_software_fallback,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t Initialize(PP_Resource graphics3d_context,
PP_VideoProfile profile,
- PP_Bool allow_software_fallback,
+ PP_HardwareAcceleration acceleration,
scoped_refptr<TrackedCallback> callback) = 0;
virtual int32_t Decode(uint32_t decode_id,
uint32_t size,
diff --git a/ppapi/thunk/ppb_video_decoder_thunk.cc b/ppapi/thunk/ppb_video_decoder_thunk.cc
index d84617c..703d100 100644
--- a/ppapi/thunk/ppb_video_decoder_thunk.cc
+++ b/ppapi/thunk/ppb_video_decoder_thunk.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// From ppb_video_decoder.idl modified Tue May 6 05:06:35 2014.
+// From ppb_video_decoder.idl modified Thu Aug 21 16:59:07 2014.
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
@@ -31,10 +31,25 @@ PP_Bool IsVideoDecoder(PP_Resource resource) {
return PP_FromBool(enter.succeeded());
}
+int32_t Initialize_0_1(PP_Resource video_decoder,
+ PP_Resource graphics3d_context,
+ PP_VideoProfile profile,
+ PP_Bool allow_software_fallback,
+ struct PP_CompletionCallback callback) {
+ VLOG(4) << "PPB_VideoDecoder::Initialize()";
+ EnterResource<PPB_VideoDecoder_API> enter(video_decoder, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->Initialize0_1(graphics3d_context,
+ profile,
+ allow_software_fallback,
+ enter.callback()));
+}
+
int32_t Initialize(PP_Resource video_decoder,
PP_Resource graphics3d_context,
PP_VideoProfile profile,
- PP_Bool allow_software_fallback,
+ PP_HardwareAcceleration acceleration,
struct PP_CompletionCallback callback) {
VLOG(4) << "PPB_VideoDecoder::Initialize()";
EnterResource<PPB_VideoDecoder_API> enter(video_decoder, callback, true);
@@ -42,7 +57,7 @@ int32_t Initialize(PP_Resource video_decoder,
return enter.retval();
return enter.SetResult(enter.object()->Initialize(graphics3d_context,
profile,
- allow_software_fallback,
+ acceleration,
enter.callback()));
}
@@ -101,6 +116,17 @@ int32_t Reset(PP_Resource video_decoder,
const PPB_VideoDecoder_0_1 g_ppb_videodecoder_thunk_0_1 = {
&Create,
&IsVideoDecoder,
+ &Initialize_0_1,
+ &Decode,
+ &GetPicture,
+ &RecyclePicture,
+ &Flush,
+ &Reset
+};
+
+const PPB_VideoDecoder_0_2 g_ppb_videodecoder_thunk_0_2 = {
+ &Create,
+ &IsVideoDecoder,
&Initialize,
&Decode,
&GetPicture,
@@ -116,5 +142,10 @@ PPAPI_THUNK_EXPORT const PPB_VideoDecoder_0_1*
return &g_ppb_videodecoder_thunk_0_1;
}
+PPAPI_THUNK_EXPORT const PPB_VideoDecoder_0_2*
+ GetPPB_VideoDecoder_0_2_Thunk() {
+ return &g_ppb_videodecoder_thunk_0_2;
+}
+
} // namespace thunk
} // namespace ppapi