Chromium Code Reviews| 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/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
| 11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
| 12 #include "media/video/video_decode_accelerator.h" | 12 #include "media/video/video_decode_accelerator.h" |
| 13 | 13 |
| 14 class GpuChannelHost; | |
| 15 | |
| 14 // This class is used to talk to VideoDecodeAccelerator in the Gpu process | 16 // This class is used to talk to VideoDecodeAccelerator in the Gpu process |
| 15 // through IPC messages. | 17 // through IPC messages. |
| 16 class GpuVideoDecodeAcceleratorHost | 18 class GpuVideoDecodeAcceleratorHost |
| 17 : public IPC::Channel::Listener, | 19 : public IPC::Channel::Listener, |
| 18 public media::VideoDecodeAccelerator, | 20 public media::VideoDecodeAccelerator, |
| 19 public base::NonThreadSafe { | 21 public base::NonThreadSafe { |
| 20 public: | 22 public: |
| 21 // |router| is used to dispatch IPC messages to this object. | 23 // |router| is used to dispatch IPC messages to this object. |
|
vrk (LEFT CHROMIUM)
2011/08/16 22:06:21
nit: router is not a parameter; update comment
Ami GONE FROM CHROMIUM
2011/08/16 22:56:26
Done.
| |
| 22 // |ipc_sender| is used to send IPC messages to Gpu process. | 24 // |channel| is used to send IPC messages to GPU process. |
| 23 GpuVideoDecodeAcceleratorHost(IPC::Message::Sender* ipc_sender, | 25 GpuVideoDecodeAcceleratorHost(GpuChannelHost* channel, |
| 24 int32 command_buffer_route_id, | 26 int32 decoder_route_id, |
| 25 media::VideoDecodeAccelerator::Client* client); | 27 media::VideoDecodeAccelerator::Client* client); |
| 26 virtual ~GpuVideoDecodeAcceleratorHost(); | 28 virtual ~GpuVideoDecodeAcceleratorHost(); |
| 27 | 29 |
| 28 // IPC::Channel::Listener implementation. | 30 // IPC::Channel::Listener implementation. |
| 29 virtual void OnChannelError() OVERRIDE; | 31 virtual void OnChannelError() OVERRIDE; |
| 30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 31 | 33 |
| 32 // media::VideoDecodeAccelerator implementation. | 34 // media::VideoDecodeAccelerator implementation. |
| 33 virtual bool Initialize(const std::vector<int32>& configs) OVERRIDE; | 35 virtual bool Initialize(const std::vector<int32>& configs) OVERRIDE; |
| 34 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 36 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 46 void OnProvidePictureBuffer( | 48 void OnProvidePictureBuffer( |
| 47 uint32 num_requested_buffers, const gfx::Size& buffer_size); | 49 uint32 num_requested_buffers, const gfx::Size& buffer_size); |
| 48 void OnDismissPictureBuffer(int32 picture_buffer_id); | 50 void OnDismissPictureBuffer(int32 picture_buffer_id); |
| 49 void OnPictureReady(int32 picture_buffer_id, int32 bitstream_buffer_id); | 51 void OnPictureReady(int32 picture_buffer_id, int32 bitstream_buffer_id); |
| 50 void OnFlushDone(); | 52 void OnFlushDone(); |
| 51 void OnResetDone(); | 53 void OnResetDone(); |
| 52 void OnEndOfStream(); | 54 void OnEndOfStream(); |
| 53 void OnErrorNotification(uint32 error); | 55 void OnErrorNotification(uint32 error); |
| 54 | 56 |
| 55 // Sends IPC messages to the Gpu process. | 57 // Sends IPC messages to the Gpu process. |
| 56 IPC::Message::Sender* ipc_sender_; | 58 GpuChannelHost* channel_; |
| 57 | 59 |
| 58 // Route ID for the command buffer associated with the context the GPU Video | 60 // Route ID for the associated decoder in the GPU process. |
| 59 // Decoder uses. | |
| 60 // TODO(fischman): storing route_id's for GPU process entities in the renderer | 61 // TODO(fischman): storing route_id's for GPU process entities in the renderer |
| 61 // process is vulnerable to GPU process crashing & being respawned, and | 62 // process is vulnerable to GPU process crashing & being respawned, and |
| 62 // attempting to use an outdated or reused route id. | 63 // attempting to use an outdated or reused route id. |
| 63 int32 command_buffer_route_id_; | 64 int32 decoder_route_id_; |
| 64 | 65 |
| 65 // Reference to the client that will receive callbacks from the decoder. | 66 // Reference to the client that will receive callbacks from the decoder. |
| 66 media::VideoDecodeAccelerator::Client* client_; | 67 media::VideoDecodeAccelerator::Client* client_; |
| 67 | 68 |
| 68 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); | 69 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | 72 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ |
| OLD | NEW |