#include "modules/congestion_controller/goog_cc/trendline_estimator.h"
#include <math.h>
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <memory>
#include <string>
#include <utility>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/field_trials_view.h"
#include "api/network_state_predictor.h"
#include "api/transport/bandwidth_usage.h"
#include "rtc_base/checks.h"
#include "rtc_base/experiments/struct_parameters_parser.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_minmax.h"
namespace webrtc {
namespace {
constexpr double kDefaultTrendlineSmoothingCoeff = …;
constexpr double kDefaultTrendlineThresholdGain = …;
const char kBweWindowSizeInPacketsExperiment[] = …;
size_t ReadTrendlineFilterWindowSize(const FieldTrialsView* key_value_config) { … }
absl::optional<double> LinearFitSlope(
const std::deque<TrendlineEstimator::PacketTiming>& packets) { … }
absl::optional<double> ComputeSlopeCap(
const std::deque<TrendlineEstimator::PacketTiming>& packets,
const TrendlineEstimatorSettings& settings) { … }
constexpr double kMaxAdaptOffsetMs = …;
constexpr double kOverUsingTimeThreshold = …;
constexpr int kMinNumDeltas = …;
constexpr int kDeltaCounterMax = …;
}
constexpr char TrendlineEstimatorSettings::kKey[];
TrendlineEstimatorSettings::TrendlineEstimatorSettings(
const FieldTrialsView* key_value_config) { … }
std::unique_ptr<StructParametersParser> TrendlineEstimatorSettings::Parser() { … }
TrendlineEstimator::TrendlineEstimator(
const FieldTrialsView* key_value_config,
NetworkStatePredictor* network_state_predictor)
: … { … }
TrendlineEstimator::~TrendlineEstimator() { … }
void TrendlineEstimator::UpdateTrendline(double recv_delta_ms,
double send_delta_ms,
int64_t send_time_ms,
int64_t arrival_time_ms,
size_t packet_size) { … }
void TrendlineEstimator::Update(double recv_delta_ms,
double send_delta_ms,
int64_t send_time_ms,
int64_t arrival_time_ms,
size_t packet_size,
bool calculated_deltas) { … }
BandwidthUsage TrendlineEstimator::State() const { … }
void TrendlineEstimator::Detect(double trend, double ts_delta, int64_t now_ms) { … }
void TrendlineEstimator::UpdateThreshold(double modified_trend,
int64_t now_ms) { … }
}