JitterEstimator: remove unnecessary helper functions
Move functionality to closer where the values are used instead,
as per previous CL comment.
Bug: webrtc:14151
Change-Id: I6b7ca02da197420a1f5da930ba87021e6f557444
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275204
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38148}
diff --git a/modules/video_coding/timing/jitter_estimator.cc b/modules/video_coding/timing/jitter_estimator.cc
index 2416ed0..6275778 100644
--- a/modules/video_coding/timing/jitter_estimator.cc
+++ b/modules/video_coding/timing/jitter_estimator.cc
@@ -243,7 +243,8 @@
// https://en.wikipedia.org/wiki/68-95-99.7_rule. Note that neither of the
// estimated means are true sample means, which implies that they are possibly
// not normally distributed. Hence, this rejection method is just a heuristic.
- double num_stddev_delay_outlier = GetNumStddevDelayOutlier();
+ double num_stddev_delay_outlier =
+ config_.num_stddev_delay_outlier.value_or(kNumStdDevDelayOutlier);
// Delay outlier rejection is two-sided.
bool abs_delay_is_not_outlier =
fabs(delay_deviation_ms) <
@@ -253,10 +254,12 @@
// median-filtered version, even if configured to use latter for the
// calculation in `CalculateEstimate()`.
// Size outlier rejection is one-sided.
+ double num_stddev_size_outlier =
+ config_.num_stddev_size_outlier.value_or(kNumStdDevSizeOutlier);
bool size_is_positive_outlier =
frame_size.bytes() >
avg_frame_size_bytes_ +
- GetNumStddevSizeOutlier() * sqrt(var_frame_size_bytes2_);
+ num_stddev_size_outlier * sqrt(var_frame_size_bytes2_);
// Only update the Kalman filter if the sample is not considered an extreme
// outlier. Even if it is an extreme outlier from a delay point of view, if
@@ -269,13 +272,16 @@
// delayed. The next frame is of normal size (delta frame), and thus deltaFS
// will be << 0. This removes all frame samples which arrives after a key
// frame.
+ double congestion_rejection_factor =
+ config_.congestion_rejection_factor.value_or(
+ kCongestionRejectionFactor);
double filtered_max_frame_size_bytes =
config_.MaxFrameSizePercentileEnabled()
? max_frame_size_bytes_percentile_.GetFilteredValue()
: max_frame_size_bytes_;
bool is_not_congested =
delta_frame_bytes >
- GetCongestionRejectionFactor() * filtered_max_frame_size_bytes;
+ congestion_rejection_factor * filtered_max_frame_size_bytes;
if (is_not_congested || config_.estimate_noise_when_congested) {
// Update the variance of the deviation from the line given by the Kalman
@@ -320,19 +326,6 @@
return config_;
}
-double JitterEstimator::GetNumStddevDelayOutlier() const {
- return config_.num_stddev_delay_outlier.value_or(kNumStdDevDelayOutlier);
-}
-
-double JitterEstimator::GetNumStddevSizeOutlier() const {
- return config_.num_stddev_size_outlier.value_or(kNumStdDevSizeOutlier);
-}
-
-double JitterEstimator::GetCongestionRejectionFactor() const {
- return config_.congestion_rejection_factor.value_or(
- kCongestionRejectionFactor);
-}
-
// Estimates the random jitter by calculating the variance of the sample
// distance from the line given by the Kalman filter.
void JitterEstimator::EstimateRandomJitter(double d_dT) {
diff --git a/modules/video_coding/timing/jitter_estimator.h b/modules/video_coding/timing/jitter_estimator.h
index 769bb12..a89a4bf 100644
--- a/modules/video_coding/timing/jitter_estimator.h
+++ b/modules/video_coding/timing/jitter_estimator.h
@@ -143,11 +143,6 @@
Config GetConfigForTest() const;
private:
- // These functions return values that could be overriden through the config.
- double GetNumStddevDelayOutlier() const;
- double GetNumStddevSizeOutlier() const;
- double GetCongestionRejectionFactor() const;
-
// Updates the random jitter estimate, i.e. the variance of the time
// deviations from the line given by the Kalman filter.
//