| Index: content/renderer/gpu/gpu_video_decode_accelerator_host.h
|
| diff --git a/content/renderer/gpu/gpu_video_decode_accelerator_host.h b/content/renderer/gpu/gpu_video_decode_accelerator_host.h
|
| index ea73da0ba3ff131492094521c60e90869c0c6965..9012168d435e0ef19269b9230a02cddd3b6acb4a 100644
|
| --- a/content/renderer/gpu/gpu_video_decode_accelerator_host.h
|
| +++ b/content/renderer/gpu/gpu_video_decode_accelerator_host.h
|
| @@ -9,23 +9,31 @@
|
|
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/shared_memory.h"
|
| +#include "base/threading/non_thread_safe.h"
|
| #include "ipc/ipc_channel.h"
|
| #include "media/video/video_decode_accelerator.h"
|
|
|
| class MessageLoop;
|
| class MessageRouter;
|
| +namespace gpu {
|
| +class CommandBufferHelper;
|
| +class ReadWriteTokens;
|
| +}
|
|
|
| // This class is used to talk to VideoDecodeAccelerator in the Gpu process
|
| // through IPC messages.
|
| -class GpuVideoDecodeAcceleratorHost : public IPC::Channel::Listener,
|
| - public media::VideoDecodeAccelerator {
|
| +class GpuVideoDecodeAcceleratorHost
|
| + : public IPC::Channel::Listener,
|
| + public media::VideoDecodeAccelerator,
|
| + public base::NonThreadSafe {
|
| public:
|
| // |router| is used to dispatch IPC messages to this object.
|
| // |ipc_sender| is used to send IPC messages to Gpu process.
|
| GpuVideoDecodeAcceleratorHost(MessageRouter* router,
|
| IPC::Message::Sender* ipc_sender,
|
| int32 decoder_host_id,
|
| - uint32 command_buffer_route_id,
|
| + int32 command_buffer_route_id,
|
| + gpu::CommandBufferHelper* cmd_buffer_helper,
|
| media::VideoDecodeAccelerator::Client* client);
|
| virtual ~GpuVideoDecodeAcceleratorHost();
|
|
|
| @@ -39,16 +47,20 @@ class GpuVideoDecodeAcceleratorHost : public IPC::Channel::Listener,
|
| const std::vector<uint32>& requested_configs,
|
| std::vector<uint32>* matched_configs) OVERRIDE;
|
| virtual bool Initialize(const std::vector<uint32>& configs) OVERRIDE;
|
| - virtual bool Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
|
| + virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
|
| virtual void AssignGLESBuffers(
|
| const std::vector<media::GLESBuffer>& buffers) OVERRIDE;
|
| virtual void AssignSysmemBuffers(
|
| const std::vector<media::SysmemBuffer>& buffers) OVERRIDE;
|
| virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
|
| - virtual bool Flush() OVERRIDE;
|
| - virtual bool Abort() OVERRIDE;
|
| + virtual void Flush() OVERRIDE;
|
| + virtual void Abort() OVERRIDE;
|
|
|
| private:
|
| + // Insert a token into the command buffer and return a token-pair suitable for
|
| + // sending over IPC for synchronization with the command buffer.
|
| + gpu::ReadWriteTokens SyncTokens();
|
| +
|
| void OnBitstreamBufferProcessed(int32 bitstream_buffer_id);
|
| void OnProvidePictureBuffer(
|
| uint32 num_requested_buffers, const gfx::Size& buffer_size, int32 mem_type);
|
| @@ -78,7 +90,18 @@ class GpuVideoDecodeAcceleratorHost : public IPC::Channel::Listener,
|
|
|
| // Route ID for the command buffer associated with the context the GPU Video
|
| // Decoder uses.
|
| - uint32 command_buffer_route_id_;
|
| + // TODO(fischman): storing route_id's for GPU process entities in the renderer
|
| + // process is vulnerable to GPU process crashing & being respawned, and
|
| + // attempting to use an outdated or reused route id.
|
| + int32 command_buffer_route_id_;
|
| +
|
| + // Helper for the command buffer associated with the context the GPU Video
|
| + // Decoder uses.
|
| + // TODO(fischman): in the out-of-process case, this won't work
|
| + // (context3d->gles2_impl() will be NULL), and will have to be replaced with a
|
| + // dedicated message such as WaitForToken, which will serialize subsequent
|
| + // message processing behind it.
|
| + gpu::CommandBufferHelper* cmd_buffer_helper_;
|
|
|
| // Temporarily store configs here in between Create and Initialize phase.
|
| std::vector<uint32> configs_;
|
|
|