Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: webrtc/modules/audio_coding/codecs/audio_encoder.h

Issue 2538493006: Reland "Renaming AudioEncoder::SetTargetBitrate and SetProjectedPacketLossRate." (Closed)
Patch Set: fixing Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 147 // This is to be deprecated. Please use |OnReceivedTargetAudioBitrate|
148 // the range [0.0, 1.0]. The encoder would typically use this information to 148 // instead.
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 149 // 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 150 // encoder is free to adjust or disregard the given bitrate (the default
155 // implementation does the latter). 151 // implementation does the latter).
156 virtual void SetTargetBitrate(int target_bps); 152 RTC_DEPRECATED virtual void SetTargetBitrate(int target_bps);
157 153
158 // Causes this encoder to let go of any other encoders it contains, and 154 // 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 155 // 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 156 // 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 157 // not call any methods on this encoder afterwards, except for the
162 // destructor. The default implementation just returns an empty array. 158 // destructor. The default implementation just returns an empty array.
163 // NOTE: This method is subject to change. Do not call or override it. 159 // NOTE: This method is subject to change. Do not call or override it.
164 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> 160 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>>
165 ReclaimContainedEncoders(); 161 ReclaimContainedEncoders();
166 162
167 // Enables audio network adaptor. Returns true if successful. 163 // Enables audio network adaptor. Returns true if successful.
168 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string, 164 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string,
169 const Clock* clock); 165 const Clock* clock);
170 166
171 // Disables audio network adaptor. 167 // Disables audio network adaptor.
172 virtual void DisableAudioNetworkAdaptor(); 168 virtual void DisableAudioNetworkAdaptor();
173 169
174 // Provides uplink bandwidth to this encoder to allow it to adapt. 170 // Provides uplink bandwidth to this encoder to allow it to adapt.
175 virtual void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps); 171 virtual void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps);
176 172
177 // Provides uplink packet loss fraction to this encoder to allow it to adapt. 173 // 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].
178 virtual void OnReceivedUplinkPacketLossFraction( 175 virtual void OnReceivedUplinkPacketLossFraction(
179 float uplink_packet_loss_fraction); 176 float uplink_packet_loss_fraction);
180 177
181 // Provides target audio bitrate to this encoder to allow it to adapt. 178 // Provides target audio bitrate to this encoder to allow it to adapt.
182 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps); 179 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps);
183 180
184 // Provides RTT to this encoder to allow it to adapt. 181 // Provides RTT to this encoder to allow it to adapt.
185 virtual void OnReceivedRtt(int rtt_ms); 182 virtual void OnReceivedRtt(int rtt_ms);
186 183
187 // To allow encoder to adapt its frame length, it must be provided the frame 184 // To allow encoder to adapt its frame length, it must be provided the frame
188 // length range that receivers can accept. 185 // length range that receivers can accept.
189 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, 186 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms,
190 int max_frame_length_ms); 187 int max_frame_length_ms);
191 188
192 protected: 189 protected:
193 // Subclasses implement this to perform the actual encoding. Called by 190 // Subclasses implement this to perform the actual encoding. Called by
194 // Encode(). 191 // Encode().
195 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, 192 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
196 rtc::ArrayView<const int16_t> audio, 193 rtc::ArrayView<const int16_t> audio,
197 rtc::Buffer* encoded) = 0; 194 rtc::Buffer* encoded) = 0;
198 }; 195 };
199 } // namespace webrtc 196 } // namespace webrtc
200 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ 197 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/acm2/audio_coding_module.cc ('k') | webrtc/modules/audio_coding/codecs/audio_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698