Index: webrtc/modules/congestion_controller/delay_based_bwe.h |
diff --git a/webrtc/modules/congestion_controller/delay_based_bwe.h b/webrtc/modules/congestion_controller/delay_based_bwe.h |
index c5be7652324bb7f26c7fbbd5fe5bb21c90684ad2..ffcfe50ecb213011833e40c4d38a6a61405d568c 100644 |
--- a/webrtc/modules/congestion_controller/delay_based_bwe.h |
+++ b/webrtc/modules/congestion_controller/delay_based_bwe.h |
@@ -11,9 +11,8 @@ |
#ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ |
#define WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ |
-#include <list> |
-#include <map> |
#include <memory> |
+#include <utility> |
#include <vector> |
#include "webrtc/base/checks.h" |
@@ -53,11 +52,33 @@ class DelayBasedBwe { |
void SetMinBitrate(int min_bitrate_bps); |
private: |
+ // Computes a bayesian estimate of the throughput given acks containing |
+ // the arrival time and payload size. Samples which are far from the current |
+ // estimate or are based on few packets are given a smaller weight, as they |
+ // are considered to be more likely to have been caused by, e.g., delay spikes |
+ // unrelated to congestion. |
+ class BitrateEstimator { |
+ public: |
+ BitrateEstimator(); |
+ void Update(int64_t now_ms, int bytes); |
+ int bitrate_bps() const; |
+ |
+ private: |
+ std::pair<float, int> UpdateWindow(int64_t now_ms, int bytes); |
+ int sum_; |
+ int count_; |
+ int64_t current_win_ms_; |
+ int64_t prev_time_ms_; |
+ float bitrate_estimate_; |
+ float bitrate_estimate_std_; |
+ }; |
+ |
Result IncomingPacketInfo(const PacketInfo& info); |
// Updates the current remote rate estimate and returns true if a valid |
// estimate exists. |
bool UpdateEstimate(int64_t packet_arrival_time_ms, |
int64_t now_ms, |
+ int acked_bitrate_bps, |
uint32_t* target_bitrate_bps); |
rtc::ThreadChecker network_thread_; |
@@ -65,7 +86,7 @@ class DelayBasedBwe { |
std::unique_ptr<InterArrival> inter_arrival_; |
std::unique_ptr<OveruseEstimator> estimator_; |
OveruseDetector detector_; |
- RateStatistics receiver_incoming_bitrate_; |
+ BitrateEstimator receiver_incoming_bitrate_; |
int64_t last_update_ms_; |
int64_t last_seen_packet_ms_; |
bool uma_recorded_; |