Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | |
| 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ipc/ipc_listener.h" | |
| 12 #include "media/video/video_encode_accelerator.h" | |
| 13 | |
| 14 namespace gfx { | |
| 15 | |
| 16 class Size; | |
| 17 | |
| 18 } // namespace gfx | |
| 19 | |
| 20 namespace content { | |
| 21 | |
| 22 class GpuChannel; | |
| 23 | |
| 24 // This class encapsulates the GPU process view of a VideoEncodeAccelerator, | |
| 25 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles | |
| 26 // IPC coming in from the renderer and passes it to the underlying VEA. | |
| 27 class GpuVideoEncodeAccelerator : public IPC::Listener, | |
| 28 public media::VideoEncodeAccelerator::Client { | |
| 29 public: | |
| 30 GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, int32 route_id); | |
| 31 virtual ~GpuVideoEncodeAccelerator(); | |
| 32 | |
| 33 // IPC::Listener implementation | |
| 34 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 35 virtual void OnChannelError() OVERRIDE; | |
| 36 | |
| 37 // media::VideoEncodeAccelerator::Client implementation. | |
| 38 virtual void NotifyInitializeDone() OVERRIDE; | |
| 39 virtual void RequireBitstreamBuffers(int input_count, | |
| 40 const gfx::Size& input_dimensions, | |
| 41 size_t output_size) OVERRIDE; | |
| 42 virtual void NotifyInputDone(int32 bitstream_buffer_id) OVERRIDE; | |
| 43 virtual void BitstreamBufferReady(int32 bitstream_buffer_id, | |
| 44 size_t payload_size, | |
| 45 bool key_frame) OVERRIDE; | |
| 46 virtual void NotifyError(media::VideoEncodeAccelerator::Error error) OVERRIDE; | |
| 47 // Static query for supported profiles. This query calls the appropriate | |
|
Ami GONE FROM CHROMIUM
2013/07/31 23:01:12
comment should be attached to function below, not
sheu
2013/08/02 01:27:49
Done.
| |
| 48 // platform-specific version. | |
| 49 | |
| 50 static std::vector<media::VideoEncodeAccelerator::SupportedProfile> | |
| 51 GetSupportedProfiles(); | |
| 52 | |
| 53 private: | |
| 54 // Create the appropriate platform-specific VEA. | |
| 55 scoped_ptr<media::VideoEncodeAccelerator> CreateEncoder(); | |
|
Ami GONE FROM CHROMIUM
2013/07/31 23:01:12
This is a member function with a single call-site
sheu
2013/08/02 01:27:49
Used to be a static, not anymore. Done.
| |
| 56 | |
| 57 bool Send(IPC::Message* message); | |
| 58 | |
| 59 // IPC handlers. | |
|
Ami GONE FROM CHROMIUM
2013/07/31 23:01:12
s/\./ proxying media::VideoEncodeAccelerator./
sheu
2013/08/02 01:27:49
Done.
| |
| 60 void OnInitialize(media::VideoFrame::Format input_format, | |
| 61 const gfx::Size& input_resolution, | |
| 62 media::VideoCodecProfile output_profile, | |
| 63 int32 initial_bitrate); | |
| 64 void OnEncode(int32 buffer_id, | |
| 65 base::SharedMemoryHandle buffer_handle, | |
| 66 uint32 buffer_size, | |
| 67 bool force_keyframe); | |
| 68 void OnUseOutputBitstreamBuffer(int32 buffer_id, | |
| 69 base::SharedMemoryHandle buffer_handle, | |
| 70 uint32 buffer_size); | |
| 71 void OnRequestEncodingParameterChange(int32 bitrate); | |
| 72 | |
| 73 // The GpuChannel owns this GpuVideoEncodeAccelerator and will outlive this. | |
|
Ami GONE FROM CHROMIUM
2013/07/31 23:01:12
s/this\./|this|./
sheu
2013/08/02 01:27:49
Done.
| |
| 74 GpuChannel* channel_; | |
| 75 const int32 route_id_; | |
| 76 | |
| 77 // Owned pointer to the underlying VideoEncodeAccelerator. | |
|
Ami GONE FROM CHROMIUM
2013/07/31 23:01:12
comment doesn't add value but meh.
| |
| 78 scoped_ptr<media::VideoEncodeAccelerator> encoder_; | |
| 79 | |
| 80 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); | |
| 81 }; | |
| 82 | |
| 83 } // namespace content | |
| 84 | |
| 85 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | |
| OLD | NEW |