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 |
147 // Causes this encoder to let go of any other encoders it contains, and | 158 // Causes this encoder to let go of any other encoders it contains, and |
148 // returns a pointer to an array where they are stored (which is required to | 159 // returns a pointer to an array where they are stored (which is required to |
149 // live as long as this encoder). Unless the returned array is empty, you may | 160 // live as long as this encoder). Unless the returned array is empty, you may |
150 // not call any methods on this encoder afterwards, except for the | 161 // not call any methods on this encoder afterwards, except for the |
151 // destructor. The default implementation just returns an empty array. | 162 // destructor. The default implementation just returns an empty array. |
152 // NOTE: This method is subject to change. Do not call or override it. | 163 // NOTE: This method is subject to change. Do not call or override it. |
153 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> | 164 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> |
154 ReclaimContainedEncoders(); | 165 ReclaimContainedEncoders(); |
155 | 166 |
156 // Enables audio network adaptor. Returns true if successful. | 167 // Enables audio network adaptor. Returns true if successful. |
157 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string, | 168 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string, |
158 const Clock* clock); | 169 const Clock* clock); |
159 | 170 |
160 // Disables audio network adaptor. | 171 // Disables audio network adaptor. |
161 virtual void DisableAudioNetworkAdaptor(); | 172 virtual void DisableAudioNetworkAdaptor(); |
162 | 173 |
163 // Provides uplink bandwidth to this encoder to allow it to adapt. | 174 // Provides uplink bandwidth to this encoder to allow it to adapt. |
164 virtual void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps); | 175 virtual void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps); |
165 | 176 |
166 // Provides uplink packet loss fraction to this encoder to allow it to adapt. | 177 // 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]. | |
168 virtual void OnReceivedUplinkPacketLossFraction( | 178 virtual void OnReceivedUplinkPacketLossFraction( |
169 float uplink_packet_loss_fraction); | 179 float uplink_packet_loss_fraction); |
170 | 180 |
171 // Provides target audio bitrate to this encoder to allow it to adapt. | 181 // Provides target audio bitrate to this encoder to allow it to adapt. |
172 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps); | 182 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps); |
173 | 183 |
174 // Provides RTT to this encoder to allow it to adapt. | 184 // Provides RTT to this encoder to allow it to adapt. |
175 virtual void OnReceivedRtt(int rtt_ms); | 185 virtual void OnReceivedRtt(int rtt_ms); |
176 | 186 |
177 // To allow encoder to adapt its frame length, it must be provided the frame | 187 // To allow encoder to adapt its frame length, it must be provided the frame |
178 // length range that receivers can accept. | 188 // length range that receivers can accept. |
179 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, | 189 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, |
180 int max_frame_length_ms); | 190 int max_frame_length_ms); |
181 | 191 |
182 protected: | 192 protected: |
183 // Subclasses implement this to perform the actual encoding. Called by | 193 // Subclasses implement this to perform the actual encoding. Called by |
184 // Encode(). | 194 // Encode(). |
185 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, | 195 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
186 rtc::ArrayView<const int16_t> audio, | 196 rtc::ArrayView<const int16_t> audio, |
187 rtc::Buffer* encoded) = 0; | 197 rtc::Buffer* encoded) = 0; |
188 }; | 198 }; |
189 } // namespace webrtc | 199 } // namespace webrtc |
190 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ | 200 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ |
OLD | NEW |