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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 if (!audio_network_adaptor_) { | 297 if (!audio_network_adaptor_) { |
298 packet_loss_fraction_smoother_->AddSample(uplink_packet_loss_fraction); | 298 packet_loss_fraction_smoother_->AddSample(uplink_packet_loss_fraction); |
299 float average_fraction_loss = packet_loss_fraction_smoother_->GetAverage(); | 299 float average_fraction_loss = packet_loss_fraction_smoother_->GetAverage(); |
300 return SetProjectedPacketLossRate(average_fraction_loss); | 300 return SetProjectedPacketLossRate(average_fraction_loss); |
301 } | 301 } |
302 audio_network_adaptor_->SetUplinkPacketLossFraction( | 302 audio_network_adaptor_->SetUplinkPacketLossFraction( |
303 uplink_packet_loss_fraction); | 303 uplink_packet_loss_fraction); |
304 ApplyAudioNetworkAdaptor(); | 304 ApplyAudioNetworkAdaptor(); |
305 } | 305 } |
306 | 306 |
| 307 void AudioEncoderOpus::OnReceivedUplinkRecoverablePacketLossFraction( |
| 308 float uplink_recoverable_packet_loss_fraction) { |
| 309 if (!audio_network_adaptor_) |
| 310 return; |
| 311 audio_network_adaptor_->SetUplinkRecoverablePacketLossFraction( |
| 312 uplink_recoverable_packet_loss_fraction); |
| 313 ApplyAudioNetworkAdaptor(); |
| 314 } |
| 315 |
307 void AudioEncoderOpus::OnReceivedUplinkBandwidth( | 316 void AudioEncoderOpus::OnReceivedUplinkBandwidth( |
308 int target_audio_bitrate_bps, | 317 int target_audio_bitrate_bps, |
309 rtc::Optional<int64_t> probing_interval_ms) { | 318 rtc::Optional<int64_t> probing_interval_ms) { |
310 if (audio_network_adaptor_) { | 319 if (audio_network_adaptor_) { |
311 audio_network_adaptor_->SetTargetAudioBitrate(target_audio_bitrate_bps); | 320 audio_network_adaptor_->SetTargetAudioBitrate(target_audio_bitrate_bps); |
312 // We give smoothed bitrate allocation to audio network adaptor as | 321 // We give smoothed bitrate allocation to audio network adaptor as |
313 // the uplink bandwidth. | 322 // the uplink bandwidth. |
314 // The probing spikes should not affect the bitrate smoother more than 25%. | 323 // The probing spikes should not affect the bitrate smoother more than 25%. |
315 // To simplify the calculations we use a step response as input signal. | 324 // To simplify the calculations we use a step response as input signal. |
316 // The step response of an exponential filter is | 325 // The step response of an exponential filter is |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 config_.uplink_bandwidth_update_interval_ms) { | 570 config_.uplink_bandwidth_update_interval_ms) { |
562 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); | 571 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); |
563 if (smoothed_bitrate) | 572 if (smoothed_bitrate) |
564 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); | 573 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); |
565 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); | 574 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); |
566 } | 575 } |
567 } | 576 } |
568 } | 577 } |
569 | 578 |
570 } // namespace webrtc | 579 } // namespace webrtc |
OLD | NEW |