#include "modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <limits>
#include <memory>
#include <string>
#include <utility>
#include "absl/types/optional.h"
#include "api/field_trials_view.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/transport/bandwidth_usage.h"
#include "api/transport/network_types.h"
#include "api/units/data_rate.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
#include "modules/congestion_controller/goog_cc/loss_based_bwe_v2.h"
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "rtc_base/checks.h"
#include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/metrics.h"
namespace webrtc {
namespace {
constexpr TimeDelta kBweIncreaseInterval = …;
constexpr TimeDelta kBweDecreaseInterval = …;
constexpr TimeDelta kStartPhase = …;
constexpr TimeDelta kBweConverganceTime = …;
constexpr int kLimitNumPackets = …;
constexpr DataRate kDefaultMaxBitrate = …;
constexpr TimeDelta kLowBitrateLogPeriod = …;
constexpr TimeDelta kRtcEventLogPeriod = …;
constexpr TimeDelta kMaxRtcpFeedbackInterval = …;
constexpr float kDefaultLowLossThreshold = …;
constexpr float kDefaultHighLossThreshold = …;
constexpr DataRate kDefaultBitrateThreshold = …;
struct UmaRampUpMetric { … };
const UmaRampUpMetric kUmaRampupMetrics[] = …;
const size_t kNumUmaRampupMetrics = …;
const char kBweLosExperiment[] = …;
bool BweLossExperimentIsEnabled(const FieldTrialsView& field_trials) { … }
bool ReadBweLossExperimentParameters(const FieldTrialsView& field_trials,
float* low_loss_threshold,
float* high_loss_threshold,
uint32_t* bitrate_threshold_kbps) { … }
}
void LinkCapacityTracker::UpdateDelayBasedEstimate(
Timestamp at_time,
DataRate delay_based_bitrate) { … }
void LinkCapacityTracker::OnStartingRate(DataRate start_rate) { … }
void LinkCapacityTracker::OnRateUpdate(absl::optional<DataRate> acknowledged,
DataRate target,
Timestamp at_time) { … }
void LinkCapacityTracker::OnRttBackoff(DataRate backoff_rate,
Timestamp at_time) { … }
DataRate LinkCapacityTracker::estimate() const { … }
RttBasedBackoff::RttBasedBackoff(const FieldTrialsView* key_value_config)
: … { … }
void RttBasedBackoff::UpdatePropagationRtt(Timestamp at_time,
TimeDelta propagation_rtt) { … }
bool RttBasedBackoff::IsRttAboveLimit() const { … }
TimeDelta RttBasedBackoff::CorrectedRtt() const { … }
RttBasedBackoff::~RttBasedBackoff() = default;
SendSideBandwidthEstimation::SendSideBandwidthEstimation(
const FieldTrialsView* key_value_config, RtcEventLog* event_log)
: … { … }
SendSideBandwidthEstimation::~SendSideBandwidthEstimation() { … }
void SendSideBandwidthEstimation::OnRouteChange() { … }
void SendSideBandwidthEstimation::SetBitrates(
absl::optional<DataRate> send_bitrate,
DataRate min_bitrate,
DataRate max_bitrate,
Timestamp at_time) { … }
void SendSideBandwidthEstimation::SetSendBitrate(DataRate bitrate,
Timestamp at_time) { … }
void SendSideBandwidthEstimation::SetMinMaxBitrate(DataRate min_bitrate,
DataRate max_bitrate) { … }
int SendSideBandwidthEstimation::GetMinBitrate() const { … }
DataRate SendSideBandwidthEstimation::target_rate() const { … }
LossBasedState SendSideBandwidthEstimation::loss_based_state() const { … }
bool SendSideBandwidthEstimation::IsRttAboveLimit() const { … }
DataRate SendSideBandwidthEstimation::GetEstimatedLinkCapacity() const { … }
void SendSideBandwidthEstimation::UpdateReceiverEstimate(Timestamp at_time,
DataRate bandwidth) { … }
void SendSideBandwidthEstimation::UpdateDelayBasedEstimate(Timestamp at_time,
DataRate bitrate) { … }
void SendSideBandwidthEstimation::SetAcknowledgedRate(
absl::optional<DataRate> acknowledged_rate,
Timestamp at_time) { … }
void SendSideBandwidthEstimation::UpdateLossBasedEstimator(
const TransportPacketsFeedback& report,
BandwidthUsage delay_detector_state,
absl::optional<DataRate> probe_bitrate,
bool in_alr) { … }
void SendSideBandwidthEstimation::UpdatePacketsLost(int64_t packets_lost,
int64_t number_of_packets,
Timestamp at_time) { … }
void SendSideBandwidthEstimation::UpdateUmaStatsPacketsLost(Timestamp at_time,
int packets_lost) { … }
void SendSideBandwidthEstimation::UpdateRtt(TimeDelta rtt, Timestamp at_time) { … }
void SendSideBandwidthEstimation::UpdateEstimate(Timestamp at_time) { … }
void SendSideBandwidthEstimation::UpdatePropagationRtt(
Timestamp at_time,
TimeDelta propagation_rtt) { … }
void SendSideBandwidthEstimation::OnSentPacket(const SentPacket& sent_packet) { … }
bool SendSideBandwidthEstimation::IsInStartPhase(Timestamp at_time) const { … }
void SendSideBandwidthEstimation::UpdateMinHistory(Timestamp at_time) { … }
DataRate SendSideBandwidthEstimation::GetUpperLimit() const { … }
void SendSideBandwidthEstimation::MaybeLogLowBitrateWarning(DataRate bitrate,
Timestamp at_time) { … }
void SendSideBandwidthEstimation::MaybeLogLossBasedEvent(Timestamp at_time) { … }
void SendSideBandwidthEstimation::UpdateTargetBitrate(DataRate new_bitrate,
Timestamp at_time) { … }
void SendSideBandwidthEstimation::ApplyTargetLimits(Timestamp at_time) { … }
bool SendSideBandwidthEstimation::LossBasedBandwidthEstimatorV1Enabled() const { … }
bool SendSideBandwidthEstimation::LossBasedBandwidthEstimatorV1ReadyForUse()
const { … }
bool SendSideBandwidthEstimation::LossBasedBandwidthEstimatorV2Enabled() const { … }
bool SendSideBandwidthEstimation::LossBasedBandwidthEstimatorV2ReadyForUse()
const { … }
bool SendSideBandwidthEstimation::PaceAtLossBasedEstimate() const { … }
}