| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | 5 #ifndef MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |
| 6 #define MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | 6 #define MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/sequence_checker.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/threading/non_thread_safe.h" | |
| 18 #include "gpu/config/gpu_info.h" | 18 #include "gpu/config/gpu_info.h" |
| 19 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 19 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 20 #include "ipc/ipc_listener.h" | 20 #include "ipc/ipc_listener.h" |
| 21 #include "media/video/video_encode_accelerator.h" | 21 #include "media/video/video_encode_accelerator.h" |
| 22 | 22 |
| 23 namespace gfx { | 23 namespace gfx { |
| 24 class Size; | 24 class Size; |
| 25 } // namespace gfx | 25 } // namespace gfx |
| 26 | 26 |
| 27 namespace gpu { | 27 namespace gpu { |
| 28 class GpuChannelHost; | 28 class GpuChannelHost; |
| 29 } // namespace gpu | 29 } // namespace gpu |
| 30 | 30 |
| 31 namespace media { | 31 namespace media { |
| 32 class VideoFrame; | 32 class VideoFrame; |
| 33 } // namespace media | 33 } // namespace media |
| 34 | 34 |
| 35 namespace tracked_objects { | 35 namespace tracked_objects { |
| 36 class Location; | 36 class Location; |
| 37 } // namespace tracked_objects | 37 } // namespace tracked_objects |
| 38 | 38 |
| 39 namespace media { | 39 namespace media { |
| 40 | 40 |
| 41 // This class is the renderer-side host for the VideoEncodeAccelerator in the | 41 // This class is the renderer-side host for the VideoEncodeAccelerator in the |
| 42 // GPU process, coordinated over IPC. | 42 // GPU process, coordinated over IPC. |
| 43 class GpuVideoEncodeAcceleratorHost | 43 class GpuVideoEncodeAcceleratorHost |
| 44 : public IPC::Listener, | 44 : public IPC::Listener, |
| 45 public VideoEncodeAccelerator, | 45 public VideoEncodeAccelerator, |
| 46 public gpu::CommandBufferProxyImpl::DeletionObserver, | 46 public gpu::CommandBufferProxyImpl::DeletionObserver { |
| 47 public base::NonThreadSafe { | |
| 48 public: | 47 public: |
| 49 // |this| is guaranteed not to outlive |impl|. (See comments for |impl_|.) | 48 // |this| is guaranteed not to outlive |impl|. (See comments for |impl_|.) |
| 50 explicit GpuVideoEncodeAcceleratorHost(gpu::CommandBufferProxyImpl* impl); | 49 explicit GpuVideoEncodeAcceleratorHost(gpu::CommandBufferProxyImpl* impl); |
| 51 | 50 |
| 52 // IPC::Listener implementation. | 51 // IPC::Listener implementation. |
| 53 bool OnMessageReceived(const IPC::Message& message) override; | 52 bool OnMessageReceived(const IPC::Message& message) override; |
| 54 void OnChannelError() override; | 53 void OnChannelError() override; |
| 55 | 54 |
| 56 // VideoEncodeAccelerator implementation. | 55 // VideoEncodeAccelerator implementation. |
| 57 SupportedProfiles GetSupportedProfiles() override; | 56 SupportedProfiles GetSupportedProfiles() override; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 typedef base::hash_map<int32_t, scoped_refptr<VideoFrame>> FrameMap; | 118 typedef base::hash_map<int32_t, scoped_refptr<VideoFrame>> FrameMap; |
| 120 FrameMap frame_map_; | 119 FrameMap frame_map_; |
| 121 | 120 |
| 122 // ID serial number for the next frame to send to the GPU process. | 121 // ID serial number for the next frame to send to the GPU process. |
| 123 int32_t next_frame_id_; | 122 int32_t next_frame_id_; |
| 124 | 123 |
| 125 // Task runner for tasks that should run on the thread this class is | 124 // Task runner for tasks that should run on the thread this class is |
| 126 // constructed. | 125 // constructed. |
| 127 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 126 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 128 | 127 |
| 128 SEQUENCE_CHECKER(sequence_checker_); |
| 129 |
| 129 // WeakPtr factory for posting tasks back to itself. | 130 // WeakPtr factory for posting tasks back to itself. |
| 130 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_; | 131 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_; |
| 131 | 132 |
| 132 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); | 133 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); |
| 133 }; | 134 }; |
| 134 | 135 |
| 135 } // namespace media | 136 } // namespace media |
| 136 | 137 |
| 137 #endif // MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | 138 #endif // MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |
| OLD | NEW |