diff options
author | vrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 20:54:02 +0000 |
---|---|---|
committer | vrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 20:54:02 +0000 |
commit | 4c2109d8bbb2fd92dc9d3be1cfc93c0877f41bad (patch) | |
tree | 99531b431061af2ae3585374c0b34ee94612aa68 /content | |
parent | 6e001bbb455a9555b95df2f8098ef105d022978b (diff) | |
download | chromium_src-4c2109d8bbb2fd92dc9d3be1cfc93c0877f41bad.zip chromium_src-4c2109d8bbb2fd92dc9d3be1cfc93c0877f41bad.tar.gz chromium_src-4c2109d8bbb2fd92dc9d3be1cfc93c0877f41bad.tar.bz2 |
Add initialization callback support for Video Decoder PPAPI.
Initializing a decoder is asynchronous, so add a callback to tell client
when the decoder is ready to use.
I confirmed that this works locally using a C plugin that I wrote on my machine.
BUG=NONE
TEST=NONE
Review URL: http://codereview.chromium.org/7065010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86699 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
8 files changed, 25 insertions, 6 deletions
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index c4db8f1..2ddd0de 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -606,6 +606,9 @@ IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers, IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_CreateDone, int32) /* Decoder ID */ +// Notify client that decoder has been initialized. +IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_InitializeDone) + // Decoder reports that a picture is ready and buffer does not need to be passed // back to the decoder. IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer, diff --git a/content/common/gpu/gpu_video_decode_accelerator.cc b/content/common/gpu/gpu_video_decode_accelerator.cc index e962968..74dae55d 100644 --- a/content/common/gpu/gpu_video_decode_accelerator.cc +++ b/content/common/gpu/gpu_video_decode_accelerator.cc @@ -173,6 +173,11 @@ void GpuVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer( } } +void GpuVideoDecodeAccelerator::NotifyInitializeDone() { + if (!Send(new AcceleratedVideoDecoderHostMsg_InitializeDone(route_id_))) + LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_InitializeDone) failed"; +} + void GpuVideoDecodeAccelerator::NotifyFlushDone() { if (!Send(new AcceleratedVideoDecoderHostMsg_FlushDone(route_id_))) LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed"; diff --git a/content/common/gpu/gpu_video_decode_accelerator.h b/content/common/gpu/gpu_video_decode_accelerator.h index 584e3de..cef9061 100644 --- a/content/common/gpu/gpu_video_decode_accelerator.h +++ b/content/common/gpu/gpu_video_decode_accelerator.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ -#define CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ +#ifndef CONTENT_COMMON_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ +#define CONTENT_COMMON_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ #include <vector> @@ -34,6 +34,7 @@ class GpuVideoDecodeAccelerator media::VideoDecodeAccelerator::MemoryType type) OVERRIDE; virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; virtual void PictureReady(const media::Picture& picture) OVERRIDE; + virtual void NotifyInitializeDone() OVERRIDE; virtual void NotifyEndOfStream() OVERRIDE; virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; @@ -77,4 +78,4 @@ class GpuVideoDecodeAccelerator DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); }; -#endif // CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ +#endif // CONTENT_COMMON_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ diff --git a/content/renderer/gpu_video_decode_accelerator_host.cc b/content/renderer/gpu_video_decode_accelerator_host.cc index 2b2d027..7da137f 100644 --- a/content/renderer/gpu_video_decode_accelerator_host.cc +++ b/content/renderer/gpu_video_decode_accelerator_host.cc @@ -46,6 +46,8 @@ bool GpuVideoDecodeAcceleratorHost::OnMessageReceived(const IPC::Message& msg) { OnProvidePictureBuffer) IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_CreateDone, OnCreateDone) + IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_InitializeDone, + OnInitializeDone) IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_PictureReady, OnPictureReady) IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_FlushDone, @@ -175,6 +177,10 @@ void GpuVideoDecodeAcceleratorHost::OnCreateDone(int32 decoder_id) { } } +void GpuVideoDecodeAcceleratorHost::OnInitializeDone() { + client_->NotifyInitializeDone(); +} + void GpuVideoDecodeAcceleratorHost::OnPictureReady( int32 picture_buffer_id, int32 bitstream_buffer_id, const gfx::Size& visible_size, const gfx::Size& decoded_size) { diff --git a/content/renderer/gpu_video_decode_accelerator_host.h b/content/renderer/gpu_video_decode_accelerator_host.h index 4503f55..8a984f3 100644 --- a/content/renderer/gpu_video_decode_accelerator_host.h +++ b/content/renderer/gpu_video_decode_accelerator_host.h @@ -53,6 +53,7 @@ class GpuVideoDecodeAcceleratorHost : public IPC::Channel::Listener, uint32 num_requested_buffers, const gfx::Size& buffer_size, int32 mem_type); void OnDismissPictureBuffer(int32 picture_buffer_id); void OnCreateDone(int32 decoder_id); + void OnInitializeDone(); void OnPictureReady(int32 picture_buffer_id, int32 bitstream_buffer_id, const gfx::Size& visible_size, diff --git a/content/renderer/gpu_video_service_host.cc b/content/renderer/gpu_video_service_host.cc index 78f2dcc..eeedb9a 100644 --- a/content/renderer/gpu_video_service_host.cc +++ b/content/renderer/gpu_video_service_host.cc @@ -42,6 +42,7 @@ bool GpuVideoServiceHost::OnMessageReceived(const IPC::Message& msg) { case AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed::ID: case AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers::ID: case AcceleratedVideoDecoderHostMsg_CreateDone::ID: + case AcceleratedVideoDecoderHostMsg_InitializeDone::ID: case AcceleratedVideoDecoderHostMsg_DismissPictureBuffer::ID: case AcceleratedVideoDecoderHostMsg_PictureReady::ID: case AcceleratedVideoDecoderHostMsg_FlushDone::ID: diff --git a/content/renderer/pepper_platform_video_decoder_impl.cc b/content/renderer/pepper_platform_video_decoder_impl.cc index 7d46cf4..b12d565 100644 --- a/content/renderer/pepper_platform_video_decoder_impl.cc +++ b/content/renderer/pepper_platform_video_decoder_impl.cc @@ -51,9 +51,6 @@ bool PlatformVideoDecoderImpl::Initialize(const std::vector<uint32>& config) { // Set a callback to ensure decoder is only initialized after channel is // connected and GpuVidoServiceHost message filter is added to channel. - // - // TODO(vrk): Initialize should take a callback to be called (on the - // renderer's thread) when initialization is completed. base::Closure initialize = base::Bind( &PlatformVideoDecoderImpl::InitializeDecoder, base::Unretained(this), @@ -139,6 +136,10 @@ void PlatformVideoDecoderImpl::PictureReady(const media::Picture& picture) { client_->PictureReady(picture); } +void PlatformVideoDecoderImpl::NotifyInitializeDone() { + client_->NotifyInitializeDone(); +} + void PlatformVideoDecoderImpl::NotifyEndOfBitstreamBuffer( int32 bitstream_buffer_id) { client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); diff --git a/content/renderer/pepper_platform_video_decoder_impl.h b/content/renderer/pepper_platform_video_decoder_impl.h index dd04b80..4588ea7 100644 --- a/content/renderer/pepper_platform_video_decoder_impl.h +++ b/content/renderer/pepper_platform_video_decoder_impl.h @@ -45,6 +45,7 @@ class PlatformVideoDecoderImpl media::VideoDecodeAccelerator::MemoryType type) OVERRIDE; virtual void PictureReady(const media::Picture& picture) OVERRIDE; virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; + virtual void NotifyInitializeDone() OVERRIDE; virtual void NotifyEndOfStream() OVERRIDE; virtual void NotifyError( media::VideoDecodeAccelerator::Error error) OVERRIDE; |