#include "modules/congestion_controller/goog_cc/probe_controller.h"
#include <algorithm>
#include <cstdint>
#include <initializer_list>
#include <memory>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/field_trials_view.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/transport/network_types.h"
#include "api/units/data_rate.h"
#include "api/units/data_size.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "logging/rtc_event_log/events/rtc_event_probe_cluster_created.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 kMaxWaitingTimeForProbingResult = …;
constexpr DataRate kDefaultMaxProbingBitrate = …;
constexpr double kBitrateDropThreshold = …;
constexpr TimeDelta kBitrateDropTimeout = …;
constexpr double kProbeFractionAfterDrop = …;
constexpr TimeDelta kAlrEndedTimeout = …;
constexpr TimeDelta kMinTimeBetweenAlrProbes = …;
constexpr double kProbeUncertainty = …;
constexpr char kBweRapidRecoveryExperiment[] = …;
void MaybeLogProbeClusterCreated(RtcEventLog* event_log,
const ProbeClusterConfig& probe) { … }
}
ProbeControllerConfig::ProbeControllerConfig(
const FieldTrialsView* key_value_config)
: … { … }
ProbeControllerConfig::ProbeControllerConfig(const ProbeControllerConfig&) =
default;
ProbeControllerConfig::~ProbeControllerConfig() = default;
ProbeController::ProbeController(const FieldTrialsView* key_value_config,
RtcEventLog* event_log)
: … { … }
ProbeController::~ProbeController() { … }
std::vector<ProbeClusterConfig> ProbeController::SetBitrates(
DataRate min_bitrate,
DataRate start_bitrate,
DataRate max_bitrate,
Timestamp at_time) { … }
std::vector<ProbeClusterConfig> ProbeController::OnMaxTotalAllocatedBitrate(
DataRate max_total_allocated_bitrate,
Timestamp at_time) { … }
std::vector<ProbeClusterConfig> ProbeController::OnNetworkAvailability(
NetworkAvailability msg) { … }
void ProbeController::UpdateState(State new_state) { … }
std::vector<ProbeClusterConfig> ProbeController::InitiateExponentialProbing(
Timestamp at_time) { … }
std::vector<ProbeClusterConfig> ProbeController::SetEstimatedBitrate(
DataRate bitrate,
BandwidthLimitedCause bandwidth_limited_cause,
Timestamp at_time) { … }
void ProbeController::EnablePeriodicAlrProbing(bool enable) { … }
void ProbeController::EnableRepeatedInitialProbing(bool enable) { … }
void ProbeController::SetAlrStartTimeMs(
absl::optional<int64_t> alr_start_time_ms) { … }
void ProbeController::SetAlrEndedTimeMs(int64_t alr_end_time_ms) { … }
std::vector<ProbeClusterConfig> ProbeController::RequestProbe(
Timestamp at_time) { … }
void ProbeController::SetNetworkStateEstimate(
webrtc::NetworkStateEstimate estimate) { … }
void ProbeController::Reset(Timestamp at_time) { … }
bool ProbeController::TimeForAlrProbe(Timestamp at_time) const { … }
bool ProbeController::TimeForNetworkStateProbe(Timestamp at_time) const { … }
bool ProbeController::TimeForNextRepeatedInitialProbe(Timestamp at_time) const { … }
std::vector<ProbeClusterConfig> ProbeController::Process(Timestamp at_time) { … }
ProbeClusterConfig ProbeController::CreateProbeClusterConfig(Timestamp at_time,
DataRate bitrate) { … }
std::vector<ProbeClusterConfig> ProbeController::InitiateProbing(
Timestamp now,
std::vector<DataRate> bitrates_to_probe,
bool probe_further) { … }
}