OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // The default implementation just returns false. | 137 // The default implementation just returns false. |
138 enum class Application { kSpeech, kAudio }; | 138 enum class Application { kSpeech, kAudio }; |
139 virtual bool SetApplication(Application application); | 139 virtual bool SetApplication(Application application); |
140 | 140 |
141 // Tells the encoder about the highest sample rate the decoder is expected to | 141 // Tells the encoder about the highest sample rate the decoder is expected to |
142 // use when decoding the bitstream. The encoder would typically use this | 142 // use when decoding the bitstream. The encoder would typically use this |
143 // information to adjust the quality of the encoding. The default | 143 // information to adjust the quality of the encoding. The default |
144 // implementation does nothing. | 144 // implementation does nothing. |
145 virtual void SetMaxPlaybackRate(int frequency_hz); | 145 virtual void SetMaxPlaybackRate(int frequency_hz); |
146 | 146 |
147 // Tells the encoder what the projected packet loss rate is. The rate is in | |
148 // the range [0.0, 1.0]. The encoder would typically use this information to | |
149 // adjust channel coding efforts, such as FEC. The default implementation | |
150 // does nothing. | |
151 virtual void SetProjectedPacketLossRate(double fraction); | |
152 | |
153 // Tells the encoder what average bitrate we'd like it to produce. The | |
154 // encoder is free to adjust or disregard the given bitrate (the default | |
155 // implementation does the latter). | |
156 virtual void SetTargetBitrate(int target_bps); | |
157 | |
158 // Causes this encoder to let go of any other encoders it contains, and | 147 // Causes this encoder to let go of any other encoders it contains, and |
159 // returns a pointer to an array where they are stored (which is required to | 148 // returns a pointer to an array where they are stored (which is required to |
160 // live as long as this encoder). Unless the returned array is empty, you may | 149 // live as long as this encoder). Unless the returned array is empty, you may |
161 // not call any methods on this encoder afterwards, except for the | 150 // not call any methods on this encoder afterwards, except for the |
162 // destructor. The default implementation just returns an empty array. | 151 // destructor. The default implementation just returns an empty array. |
163 // NOTE: This method is subject to change. Do not call or override it. | 152 // NOTE: This method is subject to change. Do not call or override it. |
164 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> | 153 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> |
165 ReclaimContainedEncoders(); | 154 ReclaimContainedEncoders(); |
166 | 155 |
167 // Enables audio network adaptor. Returns true if successful. | 156 // Enables audio network adaptor. Returns true if successful. |
168 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string, | 157 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string, |
169 const Clock* clock); | 158 const Clock* clock); |
170 | 159 |
171 // Disables audio network adaptor. | 160 // Disables audio network adaptor. |
172 virtual void DisableAudioNetworkAdaptor(); | 161 virtual void DisableAudioNetworkAdaptor(); |
173 | 162 |
174 // Provides uplink bandwidth to this encoder to allow it to adapt. | 163 // Provides uplink bandwidth to this encoder to allow it to adapt. |
175 virtual void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps); | 164 virtual void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps); |
176 | 165 |
177 // Provides uplink packet loss fraction to this encoder to allow it to adapt. | 166 // Provides uplink packet loss fraction to this encoder to allow it to adapt. |
| 167 // |uplink_packet_loss_fraction| is in the range [0.0, 1.0]. |
178 virtual void OnReceivedUplinkPacketLossFraction( | 168 virtual void OnReceivedUplinkPacketLossFraction( |
179 float uplink_packet_loss_fraction); | 169 float uplink_packet_loss_fraction); |
180 | 170 |
181 // Provides target audio bitrate to this encoder to allow it to adapt. | 171 // Provides target audio bitrate to this encoder to allow it to adapt. |
182 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps); | 172 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps); |
183 | 173 |
184 // Provides RTT to this encoder to allow it to adapt. | 174 // Provides RTT to this encoder to allow it to adapt. |
185 virtual void OnReceivedRtt(int rtt_ms); | 175 virtual void OnReceivedRtt(int rtt_ms); |
186 | 176 |
187 // To allow encoder to adapt its frame length, it must be provided the frame | 177 // To allow encoder to adapt its frame length, it must be provided the frame |
188 // length range that receives can accept. | 178 // length range that receives can accept. |
189 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, | 179 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, |
190 int max_frame_length_ms); | 180 int max_frame_length_ms); |
191 | 181 |
192 protected: | 182 protected: |
193 // Subclasses implement this to perform the actual encoding. Called by | 183 // Subclasses implement this to perform the actual encoding. Called by |
194 // Encode(). | 184 // Encode(). |
195 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, | 185 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
196 rtc::ArrayView<const int16_t> audio, | 186 rtc::ArrayView<const int16_t> audio, |
197 rtc::Buffer* encoded) = 0; | 187 rtc::Buffer* encoded) = 0; |
198 }; | 188 }; |
199 } // namespace webrtc | 189 } // namespace webrtc |
200 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ | 190 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ |
OLD | NEW |