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_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/common/gpu/gpu_command_buffer_stub.h" | 12 #include "content/common/gpu/gpu_command_buffer_stub.h" |
13 #include "gpu/config/gpu_info.h" | 13 #include "gpu/config/gpu_info.h" |
14 #include "ipc/ipc_listener.h" | 14 #include "ipc/ipc_listener.h" |
15 #include "media/video/video_encode_accelerator.h" | 15 #include "media/video/video_encode_accelerator.h" |
16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 | 17 |
| 18 struct AcceleratedVideoEncoderMsg_Encode_Params; |
| 19 |
18 namespace base { | 20 namespace base { |
19 | |
20 class SharedMemory; | 21 class SharedMemory; |
21 | |
22 } // namespace base | 22 } // namespace base |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 // This class encapsulates the GPU process view of a VideoEncodeAccelerator, | 26 // This class encapsulates the GPU process view of a VideoEncodeAccelerator, |
27 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles | 27 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles |
28 // IPC coming in from the renderer and passes it to the underlying VEA. | 28 // IPC coming in from the renderer and passes it to the underlying VEA. |
29 class GpuVideoEncodeAccelerator | 29 class GpuVideoEncodeAccelerator |
30 : public IPC::Listener, | 30 : public IPC::Listener, |
31 public media::VideoEncodeAccelerator::Client, | 31 public media::VideoEncodeAccelerator::Client, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // Return a set of VEA Create function pointers applicable to the current | 68 // Return a set of VEA Create function pointers applicable to the current |
69 // platform. | 69 // platform. |
70 static std::vector<CreateVEAFp> CreateVEAFps(); | 70 static std::vector<CreateVEAFp> CreateVEAFps(); |
71 static scoped_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA(); | 71 static scoped_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA(); |
72 static scoped_ptr<media::VideoEncodeAccelerator> CreateVaapiVEA(); | 72 static scoped_ptr<media::VideoEncodeAccelerator> CreateVaapiVEA(); |
73 static scoped_ptr<media::VideoEncodeAccelerator> CreateAndroidVEA(); | 73 static scoped_ptr<media::VideoEncodeAccelerator> CreateAndroidVEA(); |
74 | 74 |
75 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer | 75 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer |
76 // process. | 76 // process. |
77 void OnEncode(int32 frame_id, | 77 void OnEncode(const AcceleratedVideoEncoderMsg_Encode_Params& params); |
78 base::SharedMemoryHandle buffer_handle, | |
79 uint32 buffer_offset, | |
80 uint32 buffer_size, | |
81 bool force_keyframe); | |
82 void OnUseOutputBitstreamBuffer(int32 buffer_id, | 78 void OnUseOutputBitstreamBuffer(int32 buffer_id, |
83 base::SharedMemoryHandle buffer_handle, | 79 base::SharedMemoryHandle buffer_handle, |
84 uint32 buffer_size); | 80 uint32 buffer_size); |
85 void OnRequestEncodingParametersChange(uint32 bitrate, uint32 framerate); | 81 void OnRequestEncodingParametersChange(uint32 bitrate, uint32 framerate); |
86 | 82 |
87 void OnDestroy(); | 83 void OnDestroy(); |
88 | 84 |
89 void EncodeFrameFinished(int32 frame_id, scoped_ptr<base::SharedMemory> shm); | 85 void EncodeFrameFinished(int32 frame_id, scoped_ptr<base::SharedMemory> shm); |
90 | 86 |
91 void Send(IPC::Message* message); | 87 void Send(IPC::Message* message); |
(...skipping 20 matching lines...) Expand all Loading... |
112 | 108 |
113 // Weak pointer for media::VideoFrames that refer back to |this|. | 109 // Weak pointer for media::VideoFrames that refer back to |this|. |
114 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; | 110 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; |
115 | 111 |
116 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); | 112 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); |
117 }; | 113 }; |
118 | 114 |
119 } // namespace content | 115 } // namespace content |
120 | 116 |
121 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 117 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
OLD | NEW |