| 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 // |channel| is used to send IPC messages to GPU process. |
| 22 // |ipc_sender| is used to send IPC messages to Gpu process. | 24 GpuVideoDecodeAcceleratorHost(GpuChannelHost* channel, |
| 23 GpuVideoDecodeAcceleratorHost(IPC::Message::Sender* ipc_sender, | 25 int32 decoder_route_id, |
| 24 int32 command_buffer_route_id, | |
| 25 media::VideoDecodeAccelerator::Client* client); | 26 media::VideoDecodeAccelerator::Client* client); |
| 26 virtual ~GpuVideoDecodeAcceleratorHost(); | 27 virtual ~GpuVideoDecodeAcceleratorHost(); |
| 27 | 28 |
| 28 // IPC::Channel::Listener implementation. | 29 // IPC::Channel::Listener implementation. |
| 29 virtual void OnChannelError() OVERRIDE; | 30 virtual void OnChannelError() OVERRIDE; |
| 30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 31 | 32 |
| 32 // media::VideoDecodeAccelerator implementation. | 33 // media::VideoDecodeAccelerator implementation. |
| 33 virtual bool Initialize(const std::vector<int32>& configs) OVERRIDE; | 34 virtual bool Initialize(const std::vector<int32>& configs) OVERRIDE; |
| 34 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 35 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 46 void OnProvidePictureBuffer( | 47 void OnProvidePictureBuffer( |
| 47 uint32 num_requested_buffers, const gfx::Size& buffer_size); | 48 uint32 num_requested_buffers, const gfx::Size& buffer_size); |
| 48 void OnDismissPictureBuffer(int32 picture_buffer_id); | 49 void OnDismissPictureBuffer(int32 picture_buffer_id); |
| 49 void OnPictureReady(int32 picture_buffer_id, int32 bitstream_buffer_id); | 50 void OnPictureReady(int32 picture_buffer_id, int32 bitstream_buffer_id); |
| 50 void OnFlushDone(); | 51 void OnFlushDone(); |
| 51 void OnResetDone(); | 52 void OnResetDone(); |
| 52 void OnEndOfStream(); | 53 void OnEndOfStream(); |
| 53 void OnErrorNotification(uint32 error); | 54 void OnErrorNotification(uint32 error); |
| 54 | 55 |
| 55 // Sends IPC messages to the Gpu process. | 56 // Sends IPC messages to the Gpu process. |
| 56 IPC::Message::Sender* ipc_sender_; | 57 GpuChannelHost* channel_; |
| 57 | 58 |
| 58 // Route ID for the command buffer associated with the context the GPU Video | 59 // 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 | 60 // TODO(fischman): storing route_id's for GPU process entities in the renderer |
| 61 // process is vulnerable to GPU process crashing & being respawned, and | 61 // process is vulnerable to GPU process crashing & being respawned, and |
| 62 // attempting to use an outdated or reused route id. | 62 // attempting to use an outdated or reused route id. |
| 63 int32 command_buffer_route_id_; | 63 int32 decoder_route_id_; |
| 64 | 64 |
| 65 // Reference to the client that will receive callbacks from the decoder. | 65 // Reference to the client that will receive callbacks from the decoder. |
| 66 media::VideoDecodeAccelerator::Client* client_; | 66 media::VideoDecodeAccelerator::Client* client_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); | 68 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | 71 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ |
| OLD | NEW |