Index: content/common/gpu/media/gpu_video_decode_accelerator.h |
diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.h b/content/common/gpu/media/gpu_video_decode_accelerator.h |
index a7e5de33502e2ca235245e4357f08cef671d1311..e6671694d1146c3aa55ce70d1cbeed2bc56fb487 100644 |
--- a/content/common/gpu/media/gpu_video_decode_accelerator.h |
+++ b/content/common/gpu/media/gpu_video_decode_accelerator.h |
@@ -5,6 +5,7 @@ |
#ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
#define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
+#include <queue> |
#include <vector> |
#include "base/memory/scoped_ptr.h" |
@@ -13,13 +14,18 @@ |
#include "ipc/ipc_message.h" |
#include "media/video/video_decode_accelerator.h" |
+class GpuCommandBufferStub; |
+ |
class GpuVideoDecodeAccelerator |
: public base::RefCountedThreadSafe<GpuVideoDecodeAccelerator>, |
public IPC::Channel::Listener, |
public IPC::Message::Sender, |
public media::VideoDecodeAccelerator::Client { |
public: |
- GpuVideoDecodeAccelerator(IPC::Message::Sender* sender, int32 host_route_id); |
+ GpuVideoDecodeAccelerator(IPC::Message::Sender* sender, |
+ int32 host_route_id, |
+ int32 decoder_route_id, |
+ GpuCommandBufferStub* stub); |
virtual ~GpuVideoDecodeAccelerator(); |
// IPC::Channel::Listener implementation. |
@@ -52,24 +58,56 @@ class GpuVideoDecodeAccelerator |
void AssignGLESBuffers(const std::vector<media::GLESBuffer>& buffers); |
+ // Callback to be fired when the underlying stub receives a new token. |
+ void OnSetToken(int32 token); |
+ |
private: |
+ // Defers |msg| for later processing if it specifies a write token that hasn't |
+ // come to pass yet, and set |*deferred| to true. Return false if the message |
+ // failed to parse. |
+ bool DeferMessageIfNeeded(const IPC::Message& msg, bool* deferred); |
+ |
// Handlers for IPC messages. |
- void OnGetConfigs(const std::vector<uint32>& config, |
- std::vector<uint32>* configs); |
- void OnInitialize(const std::vector<uint32>& configs); |
- void OnDecode(int32 id, base::SharedMemoryHandle handle, int32 size); |
- void OnAssignSysmemBuffers(const std::vector<int32>& buffer_ids, |
- const std::vector<base::SharedMemoryHandle>& data, |
- const std::vector<gfx::Size>& sizes); |
- void OnReusePictureBuffer(int32 picture_buffer_id); |
- void OnFlush(); |
- void OnAbort(); |
+ void OnGetConfigs( |
+ const std::pair<int32, int32>& /* tokens */, |
+ const std::vector<uint32>& config, |
+ std::vector<uint32>* configs); |
+ void OnInitialize( |
+ const std::pair<int32, int32>& /* tokens */, |
+ const std::vector<uint32>& configs); |
+ void OnDecode( |
+ const std::pair<int32, int32>& /* tokens */, |
+ base::SharedMemoryHandle handle, int32 id, int32 size); |
+ void OnAssignTextures( |
+ const std::pair<int32, int32>& /* tokens */, |
+ const std::vector<int32>& buffer_ids, |
+ const std::vector<uint32>& texture_ids, |
+ const std::vector<gfx::Size>& sizes); |
+ void OnAssignSysmemBuffers( |
+ const std::pair<int32, int32>& /* tokens */, |
+ const std::vector<int32> buffer_ids, |
+ const std::vector<base::SharedMemoryHandle> data, |
+ const std::vector<gfx::Size> sizes); |
+ void OnReusePictureBuffer( |
+ const std::pair<int32, int32>& /* tokens */, |
+ int32 picture_buffer_id); |
+ void OnFlush(const std::pair<int32, int32>& /* tokens */); |
+ void OnAbort(const std::pair<int32, int32>& /* tokens */); |
// Pointer to the IPC message sender. |
IPC::Message::Sender* sender_; |
// Route ID to communicate with the host. |
- int32 route_id_; |
+ int32 host_route_id_; |
+ |
+ // Route ID of the decoder. |
+ int32 decoder_route_id_; |
+ |
+ // Messages deferred for later processing when their tokens have come to pass. |
+ std::queue<IPC::Message*> deferred_messages_; |
+ |
+ // Unowned pointer to the underlying GpuCommandBufferStub. |
+ GpuCommandBufferStub* stub_; |
// Pointer to the underlying VideoDecodeAccelerator. |
scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_; |