OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 * | 9 * |
10 */ | 10 */ |
(...skipping 27 matching lines...) Expand all Loading... |
38 int InitEncode(const VideoCodec* codec_settings, | 38 int InitEncode(const VideoCodec* codec_settings, |
39 int number_of_cores, | 39 int number_of_cores, |
40 size_t max_payload_size) override; | 40 size_t max_payload_size) override; |
41 | 41 |
42 int Encode(const VideoFrame& input_image, | 42 int Encode(const VideoFrame& input_image, |
43 const CodecSpecificInfo* codec_specific_info, | 43 const CodecSpecificInfo* codec_specific_info, |
44 const std::vector<FrameType>* frame_types) override; | 44 const std::vector<FrameType>* frame_types) override; |
45 | 45 |
46 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; | 46 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; |
47 | 47 |
48 void OnDroppedFrame() override; | |
49 int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; | 48 int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; |
50 | 49 |
51 int SetRates(uint32_t new_bitrate_kbit, uint32_t frame_rate) override; | 50 int SetRates(uint32_t new_bitrate_kbit, uint32_t frame_rate) override; |
52 | 51 |
53 int Release() override; | 52 int Release() override; |
54 | 53 |
55 const char* ImplementationName() const override; | 54 const char* ImplementationName() const override; |
56 | 55 |
57 bool SupportsNativeHandle() const override; | 56 bool SupportsNativeHandle() const override; |
58 | 57 |
59 void OnEncodedFrame(OSStatus status, | 58 void OnEncodedFrame(OSStatus status, |
60 VTEncodeInfoFlags info_flags, | 59 VTEncodeInfoFlags info_flags, |
61 CMSampleBufferRef sample_buffer, | 60 CMSampleBufferRef sample_buffer, |
62 CodecSpecificInfo codec_specific_info, | 61 CodecSpecificInfo codec_specific_info, |
63 int32_t width, | 62 int32_t width, |
64 int32_t height, | 63 int32_t height, |
65 int64_t render_time_ms, | 64 int64_t render_time_ms, |
66 uint32_t timestamp, | 65 uint32_t timestamp, |
67 VideoRotation rotation); | 66 VideoRotation rotation); |
68 | 67 |
| 68 QualityScaler::Settings GetQPThresholds() const override; |
| 69 |
69 private: | 70 private: |
70 int ResetCompressionSession(); | 71 int ResetCompressionSession(); |
71 void ConfigureCompressionSession(); | 72 void ConfigureCompressionSession(); |
72 void DestroyCompressionSession(); | 73 void DestroyCompressionSession(); |
73 rtc::scoped_refptr<VideoFrameBuffer> GetScaledBufferOnEncode( | 74 rtc::scoped_refptr<VideoFrameBuffer> GetScaledBufferOnEncode( |
74 const rtc::scoped_refptr<VideoFrameBuffer>& frame); | 75 const rtc::scoped_refptr<VideoFrameBuffer>& frame); |
75 void SetBitrateBps(uint32_t bitrate_bps); | 76 void SetBitrateBps(uint32_t bitrate_bps); |
76 void SetEncoderBitrateBps(uint32_t bitrate_bps); | 77 void SetEncoderBitrateBps(uint32_t bitrate_bps); |
77 | 78 |
78 EncodedImageCallback* callback_; | 79 EncodedImageCallback* callback_; |
79 VTCompressionSessionRef compression_session_; | 80 VTCompressionSessionRef compression_session_; |
80 BitrateAdjuster bitrate_adjuster_; | 81 BitrateAdjuster bitrate_adjuster_; |
81 uint32_t target_bitrate_bps_; | 82 uint32_t target_bitrate_bps_; |
82 uint32_t encoder_bitrate_bps_; | 83 uint32_t encoder_bitrate_bps_; |
83 int32_t width_; | 84 int32_t width_; |
84 int32_t height_; | 85 int32_t height_; |
85 | 86 |
86 rtc::CriticalSection quality_scaler_crit_; | |
87 QualityScaler quality_scaler_ GUARDED_BY(quality_scaler_crit_); | |
88 H264BitstreamParser h264_bitstream_parser_; | 87 H264BitstreamParser h264_bitstream_parser_; |
89 bool enable_scaling_; | |
90 std::vector<uint8_t> nv12_scale_buffer_; | 88 std::vector<uint8_t> nv12_scale_buffer_; |
91 }; // H264VideoToolboxEncoder | 89 }; // H264VideoToolboxEncoder |
92 | 90 |
93 } // namespace webrtc | 91 } // namespace webrtc |
94 | 92 |
95 #endif // WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_H264_VIDEO_TOOLBOX_ENCODER_H_ | 93 #endif // WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_H264_VIDEO_TOOLBOX_ENCODER_H_ |
OLD | NEW |