| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "content/common/gpu/gpu_command_buffer_stub.h" | 16 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 17 #include "gpu/config/gpu_info.h" | 17 #include "gpu/config/gpu_info.h" |
| 18 #include "ipc/ipc_listener.h" | 18 #include "ipc/ipc_listener.h" |
| 19 #include "media/video/video_encode_accelerator.h" | 19 #include "media/video/video_encode_accelerator.h" |
| 20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 21 | 21 |
| 22 struct AcceleratedVideoEncoderMsg_Encode_Params; | |
| 23 struct AcceleratedVideoEncoderMsg_Encode_Params2; | |
| 24 | |
| 25 namespace base { | 22 namespace base { |
| 26 class SharedMemory; | 23 class SharedMemory; |
| 27 } // namespace base | 24 } // namespace base |
| 28 | 25 |
| 29 namespace content { | 26 namespace content { |
| 30 | 27 |
| 28 struct VideoEncodeParams; |
| 29 struct VideoEncodeParams2; |
| 30 |
| 31 // This class encapsulates the GPU process view of a VideoEncodeAccelerator, | 31 // This class encapsulates the GPU process view of a VideoEncodeAccelerator, |
| 32 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles | 32 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles |
| 33 // IPC coming in from the renderer and passes it to the underlying VEA. | 33 // IPC coming in from the renderer and passes it to the underlying VEA. |
| 34 class GpuVideoEncodeAccelerator | 34 class GpuVideoEncodeAccelerator |
| 35 : public IPC::Listener, | 35 : public IPC::Listener, |
| 36 public media::VideoEncodeAccelerator::Client, | 36 public media::VideoEncodeAccelerator::Client, |
| 37 public GpuCommandBufferStub::DestructionObserver { | 37 public GpuCommandBufferStub::DestructionObserver { |
| 38 public: | 38 public: |
| 39 GpuVideoEncodeAccelerator(int32_t host_route_id, GpuCommandBufferStub* stub); | 39 GpuVideoEncodeAccelerator(int32_t host_route_id, GpuCommandBufferStub* stub); |
| 40 ~GpuVideoEncodeAccelerator() override; | 40 ~GpuVideoEncodeAccelerator() override; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // Return a set of VEA Create function pointers applicable to the current | 73 // Return a set of VEA Create function pointers applicable to the current |
| 74 // platform. | 74 // platform. |
| 75 static std::vector<CreateVEAFp> CreateVEAFps(); | 75 static std::vector<CreateVEAFp> CreateVEAFps(); |
| 76 static scoped_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA(); | 76 static scoped_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA(); |
| 77 static scoped_ptr<media::VideoEncodeAccelerator> CreateVaapiVEA(); | 77 static scoped_ptr<media::VideoEncodeAccelerator> CreateVaapiVEA(); |
| 78 static scoped_ptr<media::VideoEncodeAccelerator> CreateAndroidVEA(); | 78 static scoped_ptr<media::VideoEncodeAccelerator> CreateAndroidVEA(); |
| 79 | 79 |
| 80 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer | 80 // IPC handlers, proxying media::VideoEncodeAccelerator for the renderer |
| 81 // process. | 81 // process. |
| 82 void OnEncode(const AcceleratedVideoEncoderMsg_Encode_Params& params); | 82 void OnEncode(const VideoEncodeParams& params); |
| 83 void OnEncode2(const AcceleratedVideoEncoderMsg_Encode_Params2& params); | 83 void OnEncode2(const VideoEncodeParams2& params); |
| 84 void OnUseOutputBitstreamBuffer(int32_t buffer_id, | 84 void OnUseOutputBitstreamBuffer(int32_t buffer_id, |
| 85 base::SharedMemoryHandle buffer_handle, | 85 base::SharedMemoryHandle buffer_handle, |
| 86 uint32_t buffer_size); | 86 uint32_t buffer_size); |
| 87 void OnRequestEncodingParametersChange(uint32_t bitrate, uint32_t framerate); | 87 void OnRequestEncodingParametersChange(uint32_t bitrate, uint32_t framerate); |
| 88 | 88 |
| 89 void OnDestroy(); | 89 void OnDestroy(); |
| 90 | 90 |
| 91 void EncodeFrameFinished(int32_t frame_id, | 91 void EncodeFrameFinished(int32_t frame_id, |
| 92 scoped_ptr<base::SharedMemory> shm); | 92 scoped_ptr<base::SharedMemory> shm); |
| 93 void EncodeFrameFinished2(int32_t frame_id, | 93 void EncodeFrameFinished2(int32_t frame_id, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 116 | 116 |
| 117 // Weak pointer for media::VideoFrames that refer back to |this|. | 117 // Weak pointer for media::VideoFrames that refer back to |this|. |
| 118 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; | 118 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); | 120 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace content | 123 } // namespace content |
| 124 | 124 |
| 125 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 125 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
| OLD | NEW |