OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | 5 #ifndef CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ |
6 #define CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | 6 #define CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/shared_memory.h" | 11 #include "base/shared_memory.h" |
12 #include "ipc/ipc_channel.h" | 12 #include "ipc/ipc_channel.h" |
13 #include "media/video/video_decode_accelerator.h" | 13 #include "media/video/video_decode_accelerator.h" |
14 | 14 |
15 class MessageLoop; | 15 class MessageLoop; |
16 class MessageRouter; | 16 class MessageRouter; |
17 namespace gpu { | |
18 class CommandBufferHelper; | |
19 } | |
17 | 20 |
18 // This class is used to talk to VideoDecodeAccelerator in the Gpu process | 21 // This class is used to talk to VideoDecodeAccelerator in the Gpu process |
19 // through IPC messages. | 22 // through IPC messages. |
20 class GpuVideoDecodeAcceleratorHost : public IPC::Channel::Listener, | 23 class GpuVideoDecodeAcceleratorHost : public IPC::Channel::Listener, |
scherkus (not reviewing)
2011/06/27 22:54:47
nit: while you're in here could make this initiali
Ami GONE FROM CHROMIUM
2011/06/28 00:06:35
Done.
| |
21 public media::VideoDecodeAccelerator { | 24 public media::VideoDecodeAccelerator { |
22 public: | 25 public: |
23 // |router| is used to dispatch IPC messages to this object. | 26 // |router| is used to dispatch IPC messages to this object. |
24 // |ipc_sender| is used to send IPC messages to Gpu process. | 27 // |ipc_sender| is used to send IPC messages to Gpu process. |
25 GpuVideoDecodeAcceleratorHost(MessageRouter* router, | 28 GpuVideoDecodeAcceleratorHost(MessageRouter* router, |
26 IPC::Message::Sender* ipc_sender, | 29 IPC::Message::Sender* ipc_sender, |
27 int32 decoder_host_id, | 30 int32 decoder_host_id, |
28 uint32 command_buffer_route_id, | 31 int32 command_buffer_route_id, |
32 gpu::CommandBufferHelper* cmd_buffer_helper, | |
29 media::VideoDecodeAccelerator::Client* client); | 33 media::VideoDecodeAccelerator::Client* client); |
30 virtual ~GpuVideoDecodeAcceleratorHost(); | 34 virtual ~GpuVideoDecodeAcceleratorHost(); |
31 | 35 |
32 // IPC::Channel::Listener implementation. | 36 // IPC::Channel::Listener implementation. |
33 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 37 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
34 virtual void OnChannelError() OVERRIDE; | 38 virtual void OnChannelError() OVERRIDE; |
35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
36 | 40 |
37 // media::VideoDecodeAccelerator implementation. | 41 // media::VideoDecodeAccelerator implementation. |
38 virtual bool GetConfigs( | 42 virtual bool GetConfigs( |
39 const std::vector<uint32>& requested_configs, | 43 const std::vector<uint32>& requested_configs, |
40 std::vector<uint32>* matched_configs) OVERRIDE; | 44 std::vector<uint32>* matched_configs) OVERRIDE; |
41 virtual bool Initialize(const std::vector<uint32>& configs) OVERRIDE; | 45 virtual bool Initialize(const std::vector<uint32>& configs) OVERRIDE; |
42 virtual bool Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 46 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
43 virtual void AssignGLESBuffers( | 47 virtual void AssignGLESBuffers( |
44 const std::vector<media::GLESBuffer>& buffers) OVERRIDE; | 48 const std::vector<media::GLESBuffer>& buffers) OVERRIDE; |
45 virtual void AssignSysmemBuffers( | 49 virtual void AssignSysmemBuffers( |
46 const std::vector<media::SysmemBuffer>& buffers) OVERRIDE; | 50 const std::vector<media::SysmemBuffer>& buffers) OVERRIDE; |
47 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 51 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
48 virtual bool Flush() OVERRIDE; | 52 virtual void Flush() OVERRIDE; |
49 virtual bool Abort() OVERRIDE; | 53 virtual void Abort() OVERRIDE; |
50 | 54 |
51 private: | 55 private: |
56 // Insert a token into the command buffer and return a <read,write> token pair | |
57 // suitable for sending over IPC. | |
58 std::pair<int32, int32> SyncTokens(); | |
scherkus (not reviewing)
2011/06/27 22:54:47
again we might want to use a struct defined in con
Ami GONE FROM CHROMIUM
2011/06/28 00:06:35
See gpu_messages.h reply.
| |
59 | |
52 void OnBitstreamBufferProcessed(int32 bitstream_buffer_id); | 60 void OnBitstreamBufferProcessed(int32 bitstream_buffer_id); |
53 void OnProvidePictureBuffer( | 61 void OnProvidePictureBuffer( |
54 uint32 num_requested_buffers, const gfx::Size& buffer_size, int32 mem_type); | 62 uint32 num_requested_buffers, const gfx::Size& buffer_size, int32 mem_type); |
55 void OnDismissPictureBuffer(int32 picture_buffer_id); | 63 void OnDismissPictureBuffer(int32 picture_buffer_id); |
56 void OnCreateDone(int32 decoder_id); | 64 void OnCreateDone(int32 decoder_id); |
57 void OnInitializeDone(); | 65 void OnInitializeDone(); |
58 void OnPictureReady(int32 picture_buffer_id, | 66 void OnPictureReady(int32 picture_buffer_id, |
59 int32 bitstream_buffer_id, | 67 int32 bitstream_buffer_id, |
60 const gfx::Size& visible_size, | 68 const gfx::Size& visible_size, |
61 const gfx::Size& decoded_size); | 69 const gfx::Size& decoded_size); |
62 void OnFlushDone(); | 70 void OnFlushDone(); |
63 void OnAbortDone(); | 71 void OnAbortDone(); |
64 void OnEndOfStream(); | 72 void OnEndOfStream(); |
65 void OnErrorNotification(uint32 error); | 73 void OnErrorNotification(uint32 error); |
66 | 74 |
67 // A router used to send us IPC messages. | 75 // A router used to send us IPC messages. |
68 MessageRouter* router_; | 76 MessageRouter* router_; |
69 | 77 |
70 // Sends IPC messages to the Gpu process. | 78 // Sends IPC messages to the Gpu process. |
71 IPC::Message::Sender* ipc_sender_; | 79 IPC::Message::Sender* ipc_sender_; |
72 | 80 |
73 // ID of this GpuVideoDecodeAcceleratorHost. | 81 // ID of this GpuVideoDecodeAcceleratorHost. |
74 int32 decoder_host_id_; | 82 int32 decoder_host_id_; |
75 | 83 |
76 // ID of VideoDecodeAccelerator in the Gpu process. | 84 // ID of VideoDecodeAccelerator in the Gpu process. |
77 int32 decoder_id_; | 85 int32 decoder_id_; |
78 | 86 |
79 // Route ID for the command buffer associated with the context the GPU Video | 87 // Route ID for the command buffer associated with the context the GPU Video |
80 // Decoder uses. | 88 // Decoder uses. |
81 uint32 command_buffer_route_id_; | 89 int32 command_buffer_route_id_; |
90 | |
91 // Helper for the command buffer associated with the context the GPU Video | |
92 // Decoder uses. | |
93 gpu::CommandBufferHelper* cmd_buffer_helper_; | |
82 | 94 |
83 // Temporarily store configs here in between Create and Initialize phase. | 95 // Temporarily store configs here in between Create and Initialize phase. |
84 std::vector<uint32> configs_; | 96 std::vector<uint32> configs_; |
85 | 97 |
86 // Reference to the client that will receive callbacks from the decoder. | 98 // Reference to the client that will receive callbacks from the decoder. |
87 media::VideoDecodeAccelerator::Client* client_; | 99 media::VideoDecodeAccelerator::Client* client_; |
88 | 100 |
101 // MessageLoop on which this object was created. All Send()'s are trampolined | |
102 // to this loop if they are not issued on it by the client. | |
103 MessageLoop* message_loop_; | |
scherkus (not reviewing)
2011/06/27 22:54:47
do we not know which thread inside the renderer pr
Ami GONE FROM CHROMIUM
2011/06/28 00:06:35
See other response.
| |
104 | |
89 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); | 105 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); |
90 }; | 106 }; |
91 | 107 |
92 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | 108 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ |
OLD | NEW |