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 class Size; | 20 class Size; |
21 } // namespace gfx | 21 } // namespace gfx |
22 | 22 |
23 namespace media { | 23 namespace media { |
24 class VideoFrame; | 24 class VideoFrame; |
25 } // namespace media | 25 } // namespace media |
26 | 26 |
| 27 namespace tracked_objects { |
| 28 class Location; |
| 29 } // namespace tracked_objects |
| 30 |
27 namespace content { | 31 namespace content { |
28 class GpuChannelHost; | 32 class GpuChannelHost; |
29 | 33 |
30 // This class is the renderer-side host for the VideoEncodeAccelerator in the | 34 // This class is the renderer-side host for the VideoEncodeAccelerator in the |
31 // GPU process, coordinated over IPC. | 35 // GPU process, coordinated over IPC. |
32 class GpuVideoEncodeAcceleratorHost | 36 class GpuVideoEncodeAcceleratorHost |
33 : public IPC::Listener, | 37 : public IPC::Listener, |
34 public media::VideoEncodeAccelerator, | 38 public media::VideoEncodeAccelerator, |
35 public CommandBufferProxyImpl::DeletionObserver, | 39 public CommandBufferProxyImpl::DeletionObserver, |
36 public base::NonThreadSafe { | 40 public base::NonThreadSafe { |
(...skipping 22 matching lines...) Expand all Loading... |
59 void Destroy() override; | 63 void Destroy() override; |
60 | 64 |
61 // CommandBufferProxyImpl::DeletionObserver implementation. | 65 // CommandBufferProxyImpl::DeletionObserver implementation. |
62 void OnWillDeleteImpl() override; | 66 void OnWillDeleteImpl() override; |
63 | 67 |
64 private: | 68 private: |
65 // Only Destroy() should be deleting |this|. | 69 // Only Destroy() should be deleting |this|. |
66 ~GpuVideoEncodeAcceleratorHost() override; | 70 ~GpuVideoEncodeAcceleratorHost() override; |
67 | 71 |
68 // Notify |client_| of an error. Posts a task to avoid re-entrancy. | 72 // Notify |client_| of an error. Posts a task to avoid re-entrancy. |
69 void PostNotifyError(Error); | 73 void PostNotifyError(const tracked_objects::Location& location, |
| 74 Error error, const std::string& message); |
70 | 75 |
71 void Send(IPC::Message* message); | 76 void Send(IPC::Message* message); |
72 | 77 |
73 // IPC handlers, proxying media::VideoEncodeAccelerator::Client for the GPU | 78 // IPC handlers, proxying media::VideoEncodeAccelerator::Client for the GPU |
74 // process. Should not be called directly. | 79 // process. Should not be called directly. |
75 void OnRequireBitstreamBuffers(uint32 input_count, | 80 void OnRequireBitstreamBuffers(uint32 input_count, |
76 const gfx::Size& input_coded_size, | 81 const gfx::Size& input_coded_size, |
77 uint32 output_buffer_size); | 82 uint32 output_buffer_size); |
78 void OnNotifyInputDone(int32 frame_id); | 83 void OnNotifyInputDone(int32 frame_id); |
79 void OnBitstreamBufferReady(int32 bitstream_buffer_id, | 84 void OnBitstreamBufferReady(int32 bitstream_buffer_id, |
(...skipping 27 matching lines...) Expand all Loading... |
107 | 112 |
108 // WeakPtr factory for posting tasks back to itself. | 113 // WeakPtr factory for posting tasks back to itself. |
109 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_; | 114 base::WeakPtrFactory<GpuVideoEncodeAcceleratorHost> weak_this_factory_; |
110 | 115 |
111 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); | 116 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); |
112 }; | 117 }; |
113 | 118 |
114 } // namespace content | 119 } // namespace content |
115 | 120 |
116 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | 121 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ |
OLD | NEW |