/* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "modules/congestion_controller/goog_cc/probe_bitrate_estimator.h" #include <algorithm> #include <memory> #include "absl/types/optional.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_result_failure.h" #include "logging/rtc_event_log/events/rtc_event_probe_result_success.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" namespace webrtc { namespace { // The minumum number of probes we need to receive feedback about in percent // in order to have a valid estimate. constexpr double kMinReceivedProbesRatio = …; // The minumum number of bytes we need to receive feedback about in percent // in order to have a valid estimate. constexpr double kMinReceivedBytesRatio = …; // The maximum |receive rate| / |send rate| ratio for a valid estimate. constexpr float kMaxValidRatio = …; // The minimum |receive rate| / |send rate| ratio assuming that the link is // not saturated, i.e. we assume that we will receive at least // kMinRatioForUnsaturatedLink * |send rate| if |send rate| is less than the // link capacity. constexpr float kMinRatioForUnsaturatedLink = …; // The target utilization of the link. If we know true link capacity // we'd like to send at 95% of that rate. constexpr float kTargetUtilizationFraction = …; // The maximum time period over which the cluster history is retained. // This is also the maximum time period beyond which a probing burst is not // expected to last. constexpr TimeDelta kMaxClusterHistory = …; // The maximum time interval between first and the last probe on a cluster // on the sender side as well as the receive side. constexpr TimeDelta kMaxProbeInterval = …; } // namespace ProbeBitrateEstimator::ProbeBitrateEstimator(RtcEventLog* event_log) : … { … } ProbeBitrateEstimator::~ProbeBitrateEstimator() = default; absl::optional<DataRate> ProbeBitrateEstimator::HandleProbeAndEstimateBitrate( const PacketResult& packet_feedback) { … } absl::optional<DataRate> ProbeBitrateEstimator::FetchAndResetLastEstimatedBitrate() { … } void ProbeBitrateEstimator::EraseOldClusters(Timestamp timestamp) { … } } // namespace webrtc