Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: content/common/gpu/media/gpu_video_decode_accelerator.h

Issue 7260008: Implement proper synchronization between HW video decode IPC and CommandBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing compilation errors from bots. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;
scherkus (not reviewing) 2011/06/27 22:54:47 is this ref'd in anyway or is the lifetime of GCBS
Ami GONE FROM CHROMIUM 2011/06/28 00:06:35 See the BUG comment in gpu_channel.cc.
// Pointer to the underlying VideoDecodeAccelerator.
scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_;

Powered by Google App Engine
This is Rietveld 408576698