summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-15 17:09:18 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-15 17:09:18 +0000
commitce2d72c6918e9707ef3dc9987369241108ed239f (patch)
treee6cd9b58cebe325676fae66b65921282c652b2ab /ppapi/cpp
parente849792e6b65f2d495934633cc918dccfacdda5a (diff)
downloadchromium_src-ce2d72c6918e9707ef3dc9987369241108ed239f.zip
chromium_src-ce2d72c6918e9707ef3dc9987369241108ed239f.tar.gz
chromium_src-ce2d72c6918e9707ef3dc9987369241108ed239f.tar.bz2
Enable fire-and-forget Destroy of HW video decoder, and misc other improvements.
- Instead of requiring the client to wait for NotifyDestroyDone we do the asynchronous OMX teardown dance on the client's behalf. - Prettify/simplify error handling in OVDA for easier matching of errors to OMX_Core.h and to remove redundant information. - Enable previously-DISABLED_ early-teardown unittests! - Remove passing VideoDecoder_Dev object in PPP_VideoDecoder_Dev calls, because it was unnecssary, and because the ~VideoDecoder_Dev dtor is now not a no-op so we don't want to call it spuriously. - Remove accidentally re-added gpu_video_service_host.cc (originally removed in 92251, accidentally reintroduced by a bad rebase in 92383). BUG=none TEST=ovdatest passes (incl. early-teardown tests) and gles2 works (including reload and EOS handling, no crashes) Review URL: http://codereview.chromium.org/7361010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92704 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r--ppapi/cpp/dev/video_decoder_client_dev.cc25
-rw-r--r--ppapi/cpp/dev/video_decoder_client_dev.h16
-rw-r--r--ppapi/cpp/dev/video_decoder_dev.cc12
-rw-r--r--ppapi/cpp/dev/video_decoder_dev.h5
4 files changed, 21 insertions, 37 deletions
diff --git a/ppapi/cpp/dev/video_decoder_client_dev.cc b/ppapi/cpp/dev/video_decoder_client_dev.cc
index aa00c6f..e0c174c 100644
--- a/ppapi/cpp/dev/video_decoder_client_dev.cc
+++ b/ppapi/cpp/dev/video_decoder_client_dev.cc
@@ -18,7 +18,6 @@ const char kPPPVideoDecoderInterface[] = PPP_VIDEODECODER_DEV_INTERFACE;
// Callback to provide buffers for the decoded output pictures.
void ProvidePictureBuffers(PP_Instance instance,
- PP_Resource decoder_id,
uint32_t req_num_of_bufs,
struct PP_Size dimensions,
enum PP_PictureBufferType_Dev type) {
@@ -27,49 +26,41 @@ void ProvidePictureBuffers(PP_Instance instance,
if (!object)
return;
static_cast<VideoDecoderClient_Dev*>(object)->ProvidePictureBuffers(
- VideoDecoder_Dev(decoder_id), req_num_of_bufs, dimensions, type);
+ req_num_of_bufs, dimensions, type);
}
void DismissPictureBuffer(PP_Instance instance,
- PP_Resource decoder_id,
int32_t picture_buffer_id) {
void* object = pp::Instance::GetPerInstanceObject(
instance, kPPPVideoDecoderInterface);
if (!object)
return;
static_cast<VideoDecoderClient_Dev*>(object)->DismissPictureBuffer(
- VideoDecoder_Dev(decoder_id), picture_buffer_id);
+ picture_buffer_id);
}
-void PictureReady(PP_Instance instance,
- PP_Resource decoder_id,
- PP_Picture_Dev picture) {
+void PictureReady(PP_Instance instance, PP_Picture_Dev picture) {
void* object = pp::Instance::GetPerInstanceObject(
instance, kPPPVideoDecoderInterface);
if (!object)
return;
- static_cast<VideoDecoderClient_Dev*>(object)->PictureReady(
- VideoDecoder_Dev(decoder_id), picture);
+ static_cast<VideoDecoderClient_Dev*>(object)->PictureReady(picture);
}
-void EndOfStream(PP_Instance instance, PP_Resource decoder_id) {
+void EndOfStream(PP_Instance instance) {
void* object = pp::Instance::GetPerInstanceObject(
instance, kPPPVideoDecoderInterface);
if (!object)
return;
- static_cast<VideoDecoderClient_Dev*>(object)->EndOfStream(
- VideoDecoder_Dev(decoder_id));
+ static_cast<VideoDecoderClient_Dev*>(object)->EndOfStream();
}
-void NotifyError(PP_Instance instance,
- PP_Resource decoder_id,
- PP_VideoDecodeError_Dev error) {
+void NotifyError(PP_Instance instance, PP_VideoDecodeError_Dev error) {
void* object = pp::Instance::GetPerInstanceObject(
instance, kPPPVideoDecoderInterface);
if (!object)
return;
- static_cast<VideoDecoderClient_Dev*>(object)->NotifyError(
- VideoDecoder_Dev(decoder_id), error);
+ static_cast<VideoDecoderClient_Dev*>(object)->NotifyError(error);
}
static PPP_VideoDecoder_Dev videodecoder_interface = {
diff --git a/ppapi/cpp/dev/video_decoder_client_dev.h b/ppapi/cpp/dev/video_decoder_client_dev.h
index 776d54b..d1c5742 100644
--- a/ppapi/cpp/dev/video_decoder_client_dev.h
+++ b/ppapi/cpp/dev/video_decoder_client_dev.h
@@ -24,29 +24,23 @@ class VideoDecoderClient_Dev {
// Callback to provide buffers for the decoded output pictures.
virtual void ProvidePictureBuffers(
- VideoDecoder_Dev decoder,
uint32_t req_num_of_bufs,
struct PP_Size dimensions,
enum PP_PictureBufferType_Dev type) = 0;
- // Callback for decoder to delivered unneeded picture buffers back to the
+ // Callback for decoder to deliver unneeded picture buffers back to the
// plugin.
- virtual void DismissPictureBuffer(
- VideoDecoder_Dev decoder,
- int32_t picture_buffer_id) = 0;
+ virtual void DismissPictureBuffer(int32_t picture_buffer_id) = 0;
// Callback to deliver decoded pictures ready to be displayed.
- virtual void PictureReady(
- VideoDecoder_Dev decoder,
- const PP_Picture_Dev& picture) = 0;
+ virtual void PictureReady(const PP_Picture_Dev& picture) = 0;
// Callback to notify that decoder has decoded end of stream marker and has
// outputted all displayable pictures.
- virtual void EndOfStream(VideoDecoder_Dev decoder) = 0;
+ virtual void EndOfStream() = 0;
// Callback to notify about decoding errors.
- virtual void NotifyError(
- VideoDecoder_Dev decoder, PP_VideoDecodeError_Dev error) = 0;
+ virtual void NotifyError(PP_VideoDecodeError_Dev error) = 0;
private:
Instance* associated_instance_;
diff --git a/ppapi/cpp/dev/video_decoder_dev.cc b/ppapi/cpp/dev/video_decoder_dev.cc
index 89fe6ae..2ef19fc 100644
--- a/ppapi/cpp/dev/video_decoder_dev.cc
+++ b/ppapi/cpp/dev/video_decoder_dev.cc
@@ -32,7 +32,10 @@ VideoDecoder_Dev::VideoDecoder_Dev(const Instance& instance) {
VideoDecoder_Dev::VideoDecoder_Dev(PP_Resource resource) : Resource(resource) {
}
-VideoDecoder_Dev::~VideoDecoder_Dev() {}
+VideoDecoder_Dev::~VideoDecoder_Dev() {
+ get_interface<PPB_VideoDecoder_Dev>()->Destroy(pp_resource());
+}
+
int32_t VideoDecoder_Dev::Initialize(const PP_VideoConfigElement* config,
const Context3D_Dev& context,
@@ -82,11 +85,4 @@ int32_t VideoDecoder_Dev::Reset(CompletionCallback callback) {
pp_resource(), callback.pp_completion_callback());
}
-int32_t VideoDecoder_Dev::Destroy(CompletionCallback callback) {
- if (!has_interface<PPB_VideoDecoder_Dev>())
- return callback.MayForce(PP_ERROR_NOINTERFACE);
- return get_interface<PPB_VideoDecoder_Dev>()->Destroy(
- pp_resource(), callback.pp_completion_callback());
-}
-
} // namespace pp
diff --git a/ppapi/cpp/dev/video_decoder_dev.h b/ppapi/cpp/dev/video_decoder_dev.h
index 03ddc59..3d6f2b9 100644
--- a/ppapi/cpp/dev/video_decoder_dev.h
+++ b/ppapi/cpp/dev/video_decoder_dev.h
@@ -42,7 +42,10 @@ class VideoDecoder_Dev : public Resource {
void ReusePictureBuffer(int32_t picture_buffer_id);
int32_t Flush(CompletionCallback callback);
int32_t Reset(CompletionCallback callback);
- int32_t Destroy(CompletionCallback callback);
+
+ private:
+ // Disallow copy-construction to ensure Destroy() is called exactly once.
+ VideoDecoder_Dev(const VideoDecoder_Dev&);
};
} // namespace pp