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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 | 173 |
174 bool AudioEncoderCng::SetApplication(Application application) { | 174 bool AudioEncoderCng::SetApplication(Application application) { |
175 return speech_encoder_->SetApplication(application); | 175 return speech_encoder_->SetApplication(application); |
176 } | 176 } |
177 | 177 |
178 void AudioEncoderCng::SetMaxPlaybackRate(int frequency_hz) { | 178 void AudioEncoderCng::SetMaxPlaybackRate(int frequency_hz) { |
179 speech_encoder_->SetMaxPlaybackRate(frequency_hz); | 179 speech_encoder_->SetMaxPlaybackRate(frequency_hz); |
180 } | 180 } |
181 | 181 |
182 void AudioEncoderCng::SetProjectedPacketLossRate(double fraction) { | |
183 speech_encoder_->SetProjectedPacketLossRate(fraction); | |
184 } | |
185 | |
186 void AudioEncoderCng::SetTargetBitrate(int bits_per_second) { | |
187 speech_encoder_->SetTargetBitrate(bits_per_second); | |
188 } | |
189 | |
190 rtc::ArrayView<std::unique_ptr<AudioEncoder>> | 182 rtc::ArrayView<std::unique_ptr<AudioEncoder>> |
191 AudioEncoderCng::ReclaimContainedEncoders() { | 183 AudioEncoderCng::ReclaimContainedEncoders() { |
192 return rtc::ArrayView<std::unique_ptr<AudioEncoder>>(&speech_encoder_, 1); | 184 return rtc::ArrayView<std::unique_ptr<AudioEncoder>>(&speech_encoder_, 1); |
193 } | 185 } |
194 | 186 |
| 187 void AudioEncoderCng::OnReceivedUplinkPacketLossFraction( |
| 188 float uplink_packet_loss_fraction) { |
| 189 speech_encoder_->OnReceivedUplinkPacketLossFraction( |
| 190 uplink_packet_loss_fraction); |
| 191 } |
| 192 |
| 193 void AudioEncoderCng::OnReceivedTargetAudioBitrate( |
| 194 int target_audio_bitrate_bps) { |
| 195 speech_encoder_->OnReceivedTargetAudioBitrate(target_audio_bitrate_bps); |
| 196 } |
| 197 |
195 AudioEncoder::EncodedInfo AudioEncoderCng::EncodePassive( | 198 AudioEncoder::EncodedInfo AudioEncoderCng::EncodePassive( |
196 size_t frames_to_encode, | 199 size_t frames_to_encode, |
197 rtc::Buffer* encoded) { | 200 rtc::Buffer* encoded) { |
198 bool force_sid = last_frame_active_; | 201 bool force_sid = last_frame_active_; |
199 bool output_produced = false; | 202 bool output_produced = false; |
200 const size_t samples_per_10ms_frame = SamplesPer10msFrame(); | 203 const size_t samples_per_10ms_frame = SamplesPer10msFrame(); |
201 AudioEncoder::EncodedInfo info; | 204 AudioEncoder::EncodedInfo info; |
202 | 205 |
203 for (size_t i = 0; i < frames_to_encode; ++i) { | 206 for (size_t i = 0; i < frames_to_encode; ++i) { |
204 // It's important not to pass &info.encoded_bytes directly to | 207 // It's important not to pass &info.encoded_bytes directly to |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 250 } |
248 } | 251 } |
249 return info; | 252 return info; |
250 } | 253 } |
251 | 254 |
252 size_t AudioEncoderCng::SamplesPer10msFrame() const { | 255 size_t AudioEncoderCng::SamplesPer10msFrame() const { |
253 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); | 256 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); |
254 } | 257 } |
255 | 258 |
256 } // namespace webrtc | 259 } // namespace webrtc |
OLD | NEW |