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

Unified Diff: webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.cc

Issue 2585293002: Reducing calling to SmoothingFilter in Fec Controller. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.cc
diff --git a/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.cc b/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.cc
index 07495f0f85ce0f94ac6cfcb30c8fb037819e3f6c..15c12b1a1ba8bc2f22e3666b5c4e9a53166ce6e2 100644
--- a/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.cc
+++ b/webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.cc
@@ -75,8 +75,10 @@ void FecController::MakeDecision(
if (metrics.uplink_packet_loss_fraction)
packet_loss_smoothed_->AddSample(*metrics.uplink_packet_loss_fraction);
- fec_enabled_ = fec_enabled_ ? !FecDisablingDecision(metrics)
- : FecEnablingDecision(metrics);
+ const auto& packet_loss = packet_loss_smoothed_->GetAverage();
+
+ fec_enabled_ = fec_enabled_ ? !FecDisablingDecision(metrics, packet_loss)
+ : FecEnablingDecision(metrics, packet_loss);
config->enable_fec = rtc::Optional<bool>(fec_enabled_);
@@ -107,27 +109,25 @@ float FecController::GetPacketLossThreshold(
return threshold_info.offset + threshold_info.slope * bandwidth_bps;
}
-bool FecController::FecEnablingDecision(const NetworkMetrics& metrics) const {
+bool FecController::FecEnablingDecision(
+ const NetworkMetrics& metrics,
+ const rtc::Optional<float>& packet_loss) const {
if (!metrics.uplink_bandwidth_bps)
return false;
-
- auto packet_loss = packet_loss_smoothed_->GetAverage();
if (!packet_loss)
return false;
-
return *packet_loss >= GetPacketLossThreshold(*metrics.uplink_bandwidth_bps,
config_.fec_enabling_threshold,
fec_enabling_threshold_info_);
}
-bool FecController::FecDisablingDecision(const NetworkMetrics& metrics) const {
+bool FecController::FecDisablingDecision(
+ const NetworkMetrics& metrics,
+ const rtc::Optional<float>& packet_loss) const {
if (!metrics.uplink_bandwidth_bps)
return false;
-
- auto packet_loss = packet_loss_smoothed_->GetAverage();
if (!packet_loss)
return false;
-
return *packet_loss <= GetPacketLossThreshold(*metrics.uplink_bandwidth_bps,
config_.fec_disabling_threshold,
fec_disabling_threshold_info_);

Powered by Google App Engine
This is Rietveld 408576698