| 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_RENDERER_MEDIA_GPU_RTC_VIDEO_ENCODER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_ENCODER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_ENCODER_H_ | 6 #define CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_ENCODER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // RTCVideoEncoder uses a media::VideoEncodeAccelerator to implement a | 34 // RTCVideoEncoder uses a media::VideoEncodeAccelerator to implement a |
| 35 // webrtc::VideoEncoder class for WebRTC. Internally, VEA methods are | 35 // webrtc::VideoEncoder class for WebRTC. Internally, VEA methods are |
| 36 // trampolined to a private RTCVideoEncoder::Impl instance. The Impl class runs | 36 // trampolined to a private RTCVideoEncoder::Impl instance. The Impl class runs |
| 37 // on the worker thread queried from the |gpu_factories_|, which is presently | 37 // on the worker thread queried from the |gpu_factories_|, which is presently |
| 38 // the media thread. RTCVideoEncoder is sychronized by webrtc::VideoSender. | 38 // the media thread. RTCVideoEncoder is sychronized by webrtc::VideoSender. |
| 39 // webrtc::VideoEncoder methods do not run concurrently. RtcVideoEncoder needs | 39 // webrtc::VideoEncoder methods do not run concurrently. RtcVideoEncoder needs |
| 40 // to synchronize RegisterEncodeCompleteCallback and encode complete callback. | 40 // to synchronize RegisterEncodeCompleteCallback and encode complete callback. |
| 41 class CONTENT_EXPORT RTCVideoEncoder | 41 class CONTENT_EXPORT RTCVideoEncoder |
| 42 : NON_EXPORTED_BASE(public webrtc::VideoEncoder) { | 42 : NON_EXPORTED_BASE(public webrtc::VideoEncoder) { |
| 43 public: | 43 public: |
| 44 RTCVideoEncoder(webrtc::VideoCodecType type, | 44 RTCVideoEncoder(media::VideoCodecProfile profile, |
| 45 media::GpuVideoAcceleratorFactories* gpu_factories); | 45 media::GpuVideoAcceleratorFactories* gpu_factories); |
| 46 ~RTCVideoEncoder() override; | 46 ~RTCVideoEncoder() override; |
| 47 | 47 |
| 48 // webrtc::VideoEncoder implementation. Tasks are posted to |impl_| using the | 48 // webrtc::VideoEncoder implementation. Tasks are posted to |impl_| using the |
| 49 // appropriate VEA methods. | 49 // appropriate VEA methods. |
| 50 int32_t InitEncode(const webrtc::VideoCodec* codec_settings, | 50 int32_t InitEncode(const webrtc::VideoCodec* codec_settings, |
| 51 int32_t number_of_cores, | 51 int32_t number_of_cores, |
| 52 size_t max_payload_size) override; | 52 size_t max_payload_size) override; |
| 53 int32_t Encode( | 53 int32_t Encode( |
| 54 const webrtc::VideoFrame& input_image, | 54 const webrtc::VideoFrame& input_image, |
| 55 const webrtc::CodecSpecificInfo* codec_specific_info, | 55 const webrtc::CodecSpecificInfo* codec_specific_info, |
| 56 const std::vector<webrtc::FrameType>* frame_types) override; | 56 const std::vector<webrtc::FrameType>* frame_types) override; |
| 57 int32_t RegisterEncodeCompleteCallback( | 57 int32_t RegisterEncodeCompleteCallback( |
| 58 webrtc::EncodedImageCallback* callback) override; | 58 webrtc::EncodedImageCallback* callback) override; |
| 59 int32_t Release() override; | 59 int32_t Release() override; |
| 60 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; | 60 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; |
| 61 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; | 61 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; |
| 62 bool SupportsNativeHandle() const override; | 62 bool SupportsNativeHandle() const override; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 class Impl; | 65 class Impl; |
| 66 friend class RTCVideoEncoder::Impl; | 66 friend class RTCVideoEncoder::Impl; |
| 67 | 67 |
| 68 // The video codec type, as reported to WebRTC. | 68 const media::VideoCodecProfile profile_; |
| 69 const webrtc::VideoCodecType video_codec_type_; | |
| 70 | 69 |
| 71 // Factory for creating VEAs, shared memory buffers, etc. | 70 // Factory for creating VEAs, shared memory buffers, etc. |
| 72 media::GpuVideoAcceleratorFactories* gpu_factories_; | 71 media::GpuVideoAcceleratorFactories* gpu_factories_; |
| 73 | 72 |
| 74 // Task runner that the video accelerator runs on. | 73 // Task runner that the video accelerator runs on. |
| 75 const scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; | 74 const scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; |
| 76 | 75 |
| 77 // The RTCVideoEncoder::Impl that does all the work. | 76 // The RTCVideoEncoder::Impl that does all the work. |
| 78 scoped_refptr<Impl> impl_; | 77 scoped_refptr<Impl> impl_; |
| 79 | 78 |
| 80 DISALLOW_COPY_AND_ASSIGN(RTCVideoEncoder); | 79 DISALLOW_COPY_AND_ASSIGN(RTCVideoEncoder); |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 } // namespace content | 82 } // namespace content |
| 84 | 83 |
| 85 #endif // CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_ENCODER_H_ | 84 #endif // CONTENT_RENDERER_MEDIA_GPU_RTC_VIDEO_ENCODER_H_ |
| OLD | NEW |