JitterEstimator: add field trial overrides for max frame filter

This change adds a percentile filter that can replace the
"non-linear IIR" filter that is currently used to estimate the
max frame size (in bytes). The percentile filter is enabled through
the field trial, and it has two tuning parameters: the percentile
that is deemed the "max" frame, and the window length over which
the filter is applied.

Bug: webrtc:14151
Change-Id: I002609edb0a74161aaa6f0934892a1bec2ad8230
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274167
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38047}
This commit is contained in:
Rasmus Brandt
2022-09-09 13:34:15 +02:00
committed by WebRTC LUCI CQ
parent e761c3e7f3
commit 137f1e681e
4 changed files with 110 additions and 5 deletions

View File

@ -12,6 +12,7 @@
#define MODULES_VIDEO_CODING_TIMING_JITTER_ESTIMATOR_H_
#include <memory>
#include <queue>
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
@ -23,6 +24,7 @@
#include "modules/video_coding/timing/frame_delay_variation_kalman_filter.h"
#include "modules/video_coding/timing/rtt_filter.h"
#include "rtc_base/experiments/struct_parameters_parser.h"
#include "rtc_base/numerics/percentile_filter.h"
#include "rtc_base/rolling_accumulator.h"
namespace webrtc {
@ -44,11 +46,24 @@ class JitterEstimator {
std::unique_ptr<StructParametersParser> Parser() {
return StructParametersParser::Create(
"max_frame_size_percentile", &max_frame_size_percentile,
"max_frame_size_window", &max_frame_size_window,
"num_stddev_delay_outlier", &num_stddev_delay_outlier,
"num_stddev_size_outlier", &num_stddev_size_outlier,
"congestion_rejection_factor", &congestion_rejection_factor);
}
bool MaxFrameSizePercentileEnabled() const {
return max_frame_size_percentile.has_value();
}
// If set, the "max" frame size is calculated as this percentile over a
// window of recent frame sizes.
absl::optional<double> max_frame_size_percentile;
// The length of the percentile filter's window, in number of frames.
absl::optional<int> max_frame_size_window;
// A (relative) frame delay variation sample is an outlier if its absolute
// deviation from the Kalman filter model falls outside this number of
// sample standard deviations.
@ -110,6 +125,7 @@ class JitterEstimator {
private:
// These functions return values that could be overriden through the config.
double GetMaxFrameSizeEstimateBytes() const;
double GetNumStddevDelayOutlier() const;
double GetNumStddevSizeOutlier() const;
double GetCongestionRejectionFactor() const;
@ -145,10 +161,14 @@ class JitterEstimator {
// when api/units have sufficient precision.
double avg_frame_size_bytes_; // Average frame size
double var_frame_size_bytes2_; // Frame size variance. Unit is bytes^2.
// Largest frame size received (descending with a factor kPsi)
// Largest frame size received (descending with a factor kPsi).
// Used by default.
// TODO(bugs.webrtc.org/14381): Update `max_frame_size_bytes_` to DataSize
// when api/units have sufficient precision.
double max_frame_size_bytes_;
// Percentile frame sized received (over a window). Only used if configured.
PercentileFilter<int64_t> max_frame_size_bytes_percentile_;
std::queue<int64_t> frame_sizes_in_percentile_filter_;
// TODO(bugs.webrtc.org/14381): Update `startup_frame_size_sum_bytes_` to
// DataSize when api/units have sufficient precision.
double startup_frame_size_sum_bytes_;