OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void FecControllerPlrBased::UpdateNetworkMetrics( | 96 void FecControllerPlrBased::UpdateNetworkMetrics( |
97 const NetworkMetrics& network_metrics) { | 97 const NetworkMetrics& network_metrics) { |
98 if (network_metrics.uplink_bandwidth_bps) | 98 if (network_metrics.uplink_bandwidth_bps) |
99 uplink_bandwidth_bps_ = network_metrics.uplink_bandwidth_bps; | 99 uplink_bandwidth_bps_ = network_metrics.uplink_bandwidth_bps; |
100 if (network_metrics.uplink_packet_loss_fraction) { | 100 if (network_metrics.uplink_packet_loss_fraction) { |
101 packet_loss_smoother_->AddSample( | 101 packet_loss_smoother_->AddSample( |
102 *network_metrics.uplink_packet_loss_fraction); | 102 *network_metrics.uplink_packet_loss_fraction); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 void FecControllerPlrBased::MakeDecision( | 106 void FecControllerPlrBased::MakeDecision(AudioEncoderRuntimeConfig* config) { |
107 AudioNetworkAdaptor::EncoderRuntimeConfig* config) { | |
108 RTC_DCHECK(!config->enable_fec); | 107 RTC_DCHECK(!config->enable_fec); |
109 RTC_DCHECK(!config->uplink_packet_loss_fraction); | 108 RTC_DCHECK(!config->uplink_packet_loss_fraction); |
110 | 109 |
111 const auto& packet_loss = packet_loss_smoother_->GetAverage(); | 110 const auto& packet_loss = packet_loss_smoother_->GetAverage(); |
112 | 111 |
113 fec_enabled_ = fec_enabled_ ? !FecDisablingDecision(packet_loss) | 112 fec_enabled_ = fec_enabled_ ? !FecDisablingDecision(packet_loss) |
114 : FecEnablingDecision(packet_loss); | 113 : FecEnablingDecision(packet_loss); |
115 | 114 |
116 config->enable_fec = rtc::Optional<bool>(fec_enabled_); | 115 config->enable_fec = rtc::Optional<bool>(fec_enabled_); |
117 | 116 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (!uplink_bandwidth_bps_) | 161 if (!uplink_bandwidth_bps_) |
163 return false; | 162 return false; |
164 if (!packet_loss) | 163 if (!packet_loss) |
165 return false; | 164 return false; |
166 return *packet_loss <= GetPacketLossThreshold(*uplink_bandwidth_bps_, | 165 return *packet_loss <= GetPacketLossThreshold(*uplink_bandwidth_bps_, |
167 config_.fec_disabling_threshold, | 166 config_.fec_disabling_threshold, |
168 fec_disabling_threshold_info_); | 167 fec_disabling_threshold_info_); |
169 } | 168 } |
170 | 169 |
171 } // namespace webrtc | 170 } // namespace webrtc |
OLD | NEW |