summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
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 /webkit/plugins
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 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h2
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.cc57
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.h6
3 files changed, 20 insertions, 45 deletions
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index dae68a8..2b6e098 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -216,7 +216,7 @@ class PluginDelegate {
// Interface for PlatformVideoDecoder is directly inherited from general media
// VideoDecodeAccelerator interface.
class PlatformVideoDecoder : public media::VideoDecodeAccelerator {
- public:
+ protected:
virtual ~PlatformVideoDecoder() {}
};
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
index 234a906..0f887b8 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
@@ -36,7 +36,6 @@ PPB_VideoDecoder_Impl::PPB_VideoDecoder_Impl(PluginInstance* instance)
: Resource(instance),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
context3d_id_(0),
- destroy_callback_(PP_BlockUntilComplete()),
flush_callback_(PP_BlockUntilComplete()),
reset_callback_(PP_BlockUntilComplete()) {
ppp_videodecoder_ =
@@ -76,11 +75,10 @@ int32_t PPB_VideoDecoder_Impl::Initialize(
if (command_buffer_route_id == 0)
return PP_ERROR_FAILED;
- platform_video_decoder_.reset(
- instance()->delegate()->CreateVideoDecoder(
- this, command_buffer_route_id, context3d->gles2_impl()->helper()));
+ platform_video_decoder_ = instance()->delegate()->CreateVideoDecoder(
+ this, command_buffer_route_id, context3d->gles2_impl()->helper());
- if (!platform_video_decoder_.get())
+ if (!platform_video_decoder_)
return PP_ERROR_FAILED;
std::vector<uint32> copied;
@@ -108,7 +106,7 @@ int32_t PPB_VideoDecoder_Impl::Initialize(
int32_t PPB_VideoDecoder_Impl::Decode(
const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
PP_CompletionCallback callback) {
- if (!platform_video_decoder_.get())
+ if (!platform_video_decoder_)
return PP_ERROR_BADRESOURCE;
EnterResourceNoLock<PPB_Buffer_API> enter(bitstream_buffer->data, true);
@@ -129,7 +127,7 @@ int32_t PPB_VideoDecoder_Impl::Decode(
void PPB_VideoDecoder_Impl::AssignGLESBuffers(
uint32_t no_of_buffers,
const PP_GLESBuffer_Dev* buffers) {
- if (!platform_video_decoder_.get())
+ if (!platform_video_decoder_)
return;
std::vector<media::GLESBuffer> wrapped_buffers;
@@ -145,13 +143,13 @@ void PPB_VideoDecoder_Impl::AssignGLESBuffers(
}
void PPB_VideoDecoder_Impl::ReusePictureBuffer(int32_t picture_buffer_id) {
- if (!platform_video_decoder_.get())
+ if (!platform_video_decoder_)
return;
platform_video_decoder_->ReusePictureBuffer(picture_buffer_id);
}
int32_t PPB_VideoDecoder_Impl::Flush(PP_CompletionCallback callback) {
- if (!platform_video_decoder_.get())
+ if (!platform_video_decoder_)
return PP_ERROR_BADRESOURCE;
// Store the callback to be called when Flush() is done.
@@ -163,7 +161,7 @@ int32_t PPB_VideoDecoder_Impl::Flush(PP_CompletionCallback callback) {
}
int32_t PPB_VideoDecoder_Impl::Reset(PP_CompletionCallback callback) {
- if (!platform_video_decoder_.get())
+ if (!platform_video_decoder_)
return PP_ERROR_BADRESOURCE;
// Store the callback to be called when Reset() is done.
@@ -174,16 +172,10 @@ int32_t PPB_VideoDecoder_Impl::Reset(PP_CompletionCallback callback) {
return PP_OK_COMPLETIONPENDING;
}
-int32_t PPB_VideoDecoder_Impl::Destroy(PP_CompletionCallback callback) {
- if (!platform_video_decoder_.get())
- return PP_ERROR_BADRESOURCE;
-
- // Store the callback to be called when Destroy() is done.
- // TODO(fischman,vrk): consider implications of already-outstanding callback.
- destroy_callback_ = callback;
-
+void PPB_VideoDecoder_Impl::Destroy() {
+ if (!platform_video_decoder_)
+ return;
platform_video_decoder_->Destroy();
- return PP_OK_COMPLETIONPENDING;
}
void PPB_VideoDecoder_Impl::ProvidePictureBuffers(
@@ -198,17 +190,14 @@ void PPB_VideoDecoder_Impl::ProvidePictureBuffers(
PP_PictureBufferType_Dev out_type =
static_cast<PP_PictureBufferType_Dev>(type);
PP_Size out_dim = PP_MakeSize(dimensions.width(), dimensions.height());
- ScopedResourceId resource(this);
ppp_videodecoder_->ProvidePictureBuffers(
- instance()->pp_instance(), resource.id, requested_num_of_buffers,
- out_dim, out_type);
+ instance()->pp_instance(), requested_num_of_buffers, out_dim, out_type);
}
void PPB_VideoDecoder_Impl::PictureReady(const media::Picture& picture) {
if (!ppp_videodecoder_)
return;
- ScopedResourceId resource(this);
PP_Picture_Dev output;
output.picture_buffer_id = picture.picture_buffer_id();
output.bitstream_buffer_id = picture.bitstream_buffer_id();
@@ -216,25 +205,22 @@ void PPB_VideoDecoder_Impl::PictureReady(const media::Picture& picture) {
picture.visible_size().height());
output.decoded_size = PP_MakeSize(picture.decoded_size().width(),
picture.decoded_size().height());
- ppp_videodecoder_->PictureReady(
- instance()->pp_instance(), resource.id, output);
+ ppp_videodecoder_->PictureReady(instance()->pp_instance(), output);
}
void PPB_VideoDecoder_Impl::DismissPictureBuffer(int32 picture_buffer_id) {
if (!ppp_videodecoder_)
return;
- ScopedResourceId resource(this);
ppp_videodecoder_->DismissPictureBuffer(
- instance()->pp_instance(), resource.id, picture_buffer_id);
+ instance()->pp_instance(), picture_buffer_id);
}
void PPB_VideoDecoder_Impl::NotifyEndOfStream() {
if (!ppp_videodecoder_)
return;
- ScopedResourceId resource(this);
- ppp_videodecoder_->EndOfStream(instance()->pp_instance(), resource.id);
+ ppp_videodecoder_->EndOfStream(instance()->pp_instance());
}
void PPB_VideoDecoder_Impl::NotifyError(
@@ -242,13 +228,12 @@ void PPB_VideoDecoder_Impl::NotifyError(
if (!ppp_videodecoder_)
return;
- ScopedResourceId resource(this);
// TODO(vrk): This is assuming VideoDecodeAccelerator::Error and
// PP_VideoDecodeError_Dev have identical enum values. There is no compiler
// assert to guarantee this. We either need to add such asserts or
// merge these two enums.
- ppp_videodecoder_->NotifyError(instance()->pp_instance(), resource.id,
- static_cast<PP_VideoDecodeError_Dev>(error));
+ ppp_videodecoder_->NotifyError(instance()->pp_instance(),
+ static_cast<PP_VideoDecodeError_Dev>(error));
}
void PPB_VideoDecoder_Impl::NotifyResetDone() {
@@ -259,14 +244,6 @@ void PPB_VideoDecoder_Impl::NotifyResetDone() {
PP_RunAndClearCompletionCallback(&reset_callback_, PP_OK);
}
-void PPB_VideoDecoder_Impl::NotifyDestroyDone() {
- if (destroy_callback_.func == NULL)
- return;
-
- // Call the callback that was stored to be called when Destroy is done.
- PP_RunAndClearCompletionCallback(&destroy_callback_, PP_OK);
-}
-
void PPB_VideoDecoder_Impl::NotifyEndOfBitstreamBuffer(
int32 bitstream_buffer_id) {
CallbackById::iterator it =
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.h b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
index 76c5b6e..b3137b7 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.h
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
@@ -49,7 +49,7 @@ class PPB_VideoDecoder_Impl : public Resource,
virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE;
virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE;
virtual int32_t Reset(PP_CompletionCallback callback) OVERRIDE;
- virtual int32_t Destroy(PP_CompletionCallback callback) OVERRIDE;
+ virtual void Destroy() OVERRIDE;
// media::VideoDecodeAccelerator::Client implementation.
virtual void ProvidePictureBuffers(
@@ -65,7 +65,6 @@ class PPB_VideoDecoder_Impl : public Resource,
virtual void NotifyFlushDone() OVERRIDE;
virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE;
virtual void NotifyResetDone() OVERRIDE;
- virtual void NotifyDestroyDone() OVERRIDE;
private:
// Key: bitstream_buffer_id, value: callback to run when bitstream decode is
@@ -74,7 +73,7 @@ class PPB_VideoDecoder_Impl : public Resource,
// This is NULL before initialization, and if this PPB_VideoDecoder_Impl is
// swapped with another.
- scoped_ptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_;
+ scoped_refptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_;
// Factory to produce our callbacks.
base::ScopedCallbackFactory<PPB_VideoDecoder_Impl> callback_factory_;
@@ -84,7 +83,6 @@ class PPB_VideoDecoder_Impl : public Resource,
PP_Resource context3d_id_;
PP_CompletionCallback initialization_callback_;
- PP_CompletionCallback destroy_callback_;
PP_CompletionCallback flush_callback_;
PP_CompletionCallback reset_callback_;
CallbackById bitstream_buffer_callbacks_;