From f2a7a34abf1bdc1b3e93cfd1e8f1eed192c1f8ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 31 Jan 2024 18:46:55 +0200 Subject: [PATCH] rtp: gcc: Use `x += ...` instead of `x = x + ...` --- net/rtp/src/gcc/imp.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/rtp/src/gcc/imp.rs b/net/rtp/src/gcc/imp.rs index 84269ce0..84f6daa6 100644 --- a/net/rtp/src/gcc/imp.rs +++ b/net/rtp/src/gcc/imp.rs @@ -559,8 +559,7 @@ impl Detector { let estimate_uncertainty = self.estimate_error + Q; self.gain = estimate_uncertainty / (estimate_uncertainty + self.measurement_uncertainty); - self.estimate = - self.estimate + Duration::nanoseconds((self.gain * zms * 1_000_000.) as i64); + self.estimate += Duration::nanoseconds((self.gain * zms * 1_000_000.) as i64); self.estimate_error = (1. - self.gain) * estimate_uncertainty; } @@ -618,7 +617,7 @@ impl Detector { let d = abs_estimate - self.threshold; let add = k * d.num_milliseconds() as f64 * time_delta.num_milliseconds() as f64; - self.threshold = self.threshold + Duration::nanoseconds((add * 100. * 1_000.) as i64); + self.threshold += Duration::nanoseconds((add * 100. * 1_000.) as i64); self.threshold = self.threshold.clamp(*MIN_THRESHOLD, *MAX_THRESHOLD); self.last_threshold_update = Some(now); } @@ -639,7 +638,7 @@ impl Detector { ); match th_usage { NetworkUsage::Over => { - self.increasing_duration = self.increasing_duration + delta; + self.increasing_duration += delta; self.increasing_counter += 1; if self.increasing_duration > *OVERUSE_TIME_TH