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 |
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ |
13 | 13 |
14 #include <algorithm> | 14 #include <algorithm> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/array_view.h" | 17 #include "webrtc/base/array_view.h" |
18 #include "webrtc/base/buffer.h" | 18 #include "webrtc/base/buffer.h" |
19 #include "webrtc/base/deprecation.h" | 19 #include "webrtc/base/deprecation.h" |
20 #include "webrtc/base/optional.h" | |
20 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
21 | 22 |
22 namespace webrtc { | 23 namespace webrtc { |
23 | 24 |
24 class Clock; | 25 class Clock; |
25 | 26 |
26 // This is the interface class for encoders in AudioCoding module. Each codec | 27 // This is the interface class for encoders in AudioCoding module. Each codec |
27 // type must have an implementation of this class. | 28 // type must have an implementation of this class. |
28 class AudioEncoder { | 29 class AudioEncoder { |
29 public: | 30 public: |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> | 161 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> |
161 ReclaimContainedEncoders(); | 162 ReclaimContainedEncoders(); |
162 | 163 |
163 // Enables audio network adaptor. Returns true if successful. | 164 // Enables audio network adaptor. Returns true if successful. |
164 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string, | 165 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string, |
165 const Clock* clock); | 166 const Clock* clock); |
166 | 167 |
167 // Disables audio network adaptor. | 168 // Disables audio network adaptor. |
168 virtual void DisableAudioNetworkAdaptor(); | 169 virtual void DisableAudioNetworkAdaptor(); |
169 | 170 |
170 // Provides uplink bandwidth to this encoder to allow it to adapt. | |
171 virtual void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps); | |
minyue-webrtc
2016/12/28 08:46:07
try not to deprecate it now. since it is not a nec
michaelt
2017/01/09 09:24:05
Done.
| |
172 | |
173 // Provides uplink packet loss fraction to this encoder to allow it to adapt. | 171 // Provides uplink packet loss fraction to this encoder to allow it to adapt. |
174 // |uplink_packet_loss_fraction| is in the range [0.0, 1.0]. | 172 // |uplink_packet_loss_fraction| is in the range [0.0, 1.0]. |
175 virtual void OnReceivedUplinkPacketLossFraction( | 173 virtual void OnReceivedUplinkPacketLossFraction( |
176 float uplink_packet_loss_fraction); | 174 float uplink_packet_loss_fraction); |
177 | 175 |
178 // Provides target audio bitrate to this encoder to allow it to adapt. | 176 // Provides target audio bitrate to this encoder to allow it to adapt. |
179 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps); | 177 RTC_DEPRECATED virtual void OnReceivedTargetAudioBitrate(int target_bps); |
178 | |
179 // Provides target audio bitrate to this encoder to allow it to adapt and the | |
minyue-webrtc
2016/12/27 14:48:58
// Provides target audio bitrate and corresponding
michaelt
2017/01/09 09:24:05
Done.
| |
180 // corresponding probing interval of the bandwidth estimator. | |
181 virtual void OnReceivedTargetAudioBitrate( | |
182 int target_audio_bitrate_bps, | |
183 rtc::Optional<int64_t> probing_interval_ms); | |
180 | 184 |
181 // Provides RTT to this encoder to allow it to adapt. | 185 // Provides RTT to this encoder to allow it to adapt. |
182 virtual void OnReceivedRtt(int rtt_ms); | 186 virtual void OnReceivedRtt(int rtt_ms); |
183 | 187 |
184 // Provides overhead to this encoder to adapt. The overhead is the number of | 188 // Provides overhead to this encoder to adapt. The overhead is the number of |
185 // bytes that will be added to each packet the encoder generates. | 189 // bytes that will be added to each packet the encoder generates. |
186 virtual void OnReceivedOverhead(size_t overhead_bytes_per_packet); | 190 virtual void OnReceivedOverhead(size_t overhead_bytes_per_packet); |
187 | 191 |
188 // To allow encoder to adapt its frame length, it must be provided the frame | 192 // To allow encoder to adapt its frame length, it must be provided the frame |
189 // length range that receivers can accept. | 193 // length range that receivers can accept. |
190 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, | 194 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, |
191 int max_frame_length_ms); | 195 int max_frame_length_ms); |
192 | 196 |
193 protected: | 197 protected: |
194 // Subclasses implement this to perform the actual encoding. Called by | 198 // Subclasses implement this to perform the actual encoding. Called by |
195 // Encode(). | 199 // Encode(). |
196 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, | 200 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
197 rtc::ArrayView<const int16_t> audio, | 201 rtc::ArrayView<const int16_t> audio, |
198 rtc::Buffer* encoded) = 0; | 202 rtc::Buffer* encoded) = 0; |
199 }; | 203 }; |
200 } // namespace webrtc | 204 } // namespace webrtc |
201 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ | 205 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ |
OLD | NEW |