1 /* 2 * Copyright 2018 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 #ifndef MODULES_CONGESTION_CONTROLLER_GOOG_CC_LINK_CAPACITY_ESTIMATOR_H_ 11 #define MODULES_CONGESTION_CONTROLLER_GOOG_CC_LINK_CAPACITY_ESTIMATOR_H_ 12 13 #include "absl/types/optional.h" 14 #include "api/units/data_rate.h" 15 16 namespace webrtc { 17 class LinkCapacityEstimator { 18 public: 19 LinkCapacityEstimator(); 20 DataRate UpperBound() const; 21 DataRate LowerBound() const; 22 void Reset(); 23 void OnOveruseDetected(DataRate acknowledged_rate); 24 void OnProbeRate(DataRate probe_rate); 25 bool has_estimate() const; 26 DataRate estimate() const; 27 28 private: 29 friend class GoogCcStatePrinter; 30 void Update(DataRate capacity_sample, double alpha); 31 32 double deviation_estimate_kbps() const; 33 absl::optional<double> estimate_kbps_; 34 double deviation_kbps_ = 0.4; 35 }; 36 } // namespace webrtc 37 38 #endif // MODULES_CONGESTION_CONTROLLER_GOOG_CC_LINK_CAPACITY_ESTIMATOR_H_ 39