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 CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 14 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
15 #include "gpu/config/gpu_info.h" | 15 #include "gpu/config/gpu_info.h" |
16 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
17 #include "media/video/video_encode_accelerator.h" | 17 #include "media/video/video_encode_accelerator.h" |
18 | 18 |
19 namespace gfx { | 19 namespace gfx { |
20 | |
21 class Size; | 20 class Size; |
22 | |
23 } // namespace gfx | 21 } // namespace gfx |
24 | 22 |
25 namespace media { | 23 namespace media { |
26 | |
27 class VideoFrame; | 24 class VideoFrame; |
28 | |
29 } // namespace media | 25 } // namespace media |
30 | 26 |
31 namespace content { | 27 namespace content { |
32 | |
33 class GpuChannelHost; | 28 class GpuChannelHost; |
34 | 29 |
35 // This class is the renderer-side host for the VideoEncodeAccelerator in the | 30 // This class is the renderer-side host for the VideoEncodeAccelerator in the |
36 // GPU process, coordinated over IPC. | 31 // GPU process, coordinated over IPC. |
37 class GpuVideoEncodeAcceleratorHost | 32 class GpuVideoEncodeAcceleratorHost |
38 : public IPC::Listener, | 33 : public IPC::Listener, |
39 public media::VideoEncodeAccelerator, | 34 public media::VideoEncodeAccelerator, |
40 public CommandBufferProxyImpl::DeletionObserver, | 35 public CommandBufferProxyImpl::DeletionObserver, |
41 public base::NonThreadSafe { | 36 public base::NonThreadSafe { |
42 public: | 37 public: |
(...skipping 13 matching lines...) Expand all Loading... |
56 media::VideoCodecProfile output_profile, | 51 media::VideoCodecProfile output_profile, |
57 uint32 initial_bitrate, | 52 uint32 initial_bitrate, |
58 Client* client) override; | 53 Client* client) override; |
59 void Encode(const scoped_refptr<media::VideoFrame>& frame, | 54 void Encode(const scoped_refptr<media::VideoFrame>& frame, |
60 bool force_keyframe) override; | 55 bool force_keyframe) override; |
61 void UseOutputBitstreamBuffer(const media::BitstreamBuffer& buffer) override; | 56 void UseOutputBitstreamBuffer(const media::BitstreamBuffer& buffer) override; |
62 void RequestEncodingParametersChange(uint32 bitrate, | 57 void RequestEncodingParametersChange(uint32 bitrate, |
63 uint32 framerate_num) override; | 58 uint32 framerate_num) override; |
64 void Destroy() override; | 59 void Destroy() override; |
65 | 60 |
66 // CommandBufferProxyImpl::DeletionObserver implemetnation. | 61 // CommandBufferProxyImpl::DeletionObserver implementation. |
67 void OnWillDeleteImpl() override; | 62 void OnWillDeleteImpl() override; |
68 | 63 |
69 private: | 64 private: |
70 // Only Destroy() should be deleting |this|. | 65 // Only Destroy() should be deleting |this|. |
71 ~GpuVideoEncodeAcceleratorHost() override; | 66 ~GpuVideoEncodeAcceleratorHost() override; |
72 | 67 |
73 // Notify |client_| of an error. Posts a task to avoid re-entrancy. | 68 // Notify |client_| of an error. Posts a task to avoid re-entrancy. |
74 void PostNotifyError(Error); | 69 void PostNotifyError(Error); |
75 | 70 |
76 void Send(IPC::Message* message); | 71 void Send(IPC::Message* message); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 107 |
113 // WeakPtr factory for posting tasks back to itself. | 108 // WeakPtr factory for posting tasks back to itself. |
114 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_; | 109 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_; |
115 | 110 |
116 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); | 111 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); |
117 }; | 112 }; |
118 | 113 |
119 } // namespace content | 114 } // namespace content |
120 | 115 |
121 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | 116 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |
OLD | NEW |