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 c44ea12e1c752479f20fa3798d0f9436823918bd..eccd73ac4d49f7daea6b7fd1ae7366b6e6089d50 100644 |
--- a/webrtc/modules/congestion_controller/delay_based_bwe.h |
+++ b/webrtc/modules/congestion_controller/delay_based_bwe.h |
@@ -48,8 +48,7 @@ |
virtual ~DelayBasedBwe(); |
Result IncomingPacketFeedbackVector( |
- const std::vector<PacketFeedback>& packet_feedback_vector, |
- rtc::Optional<uint32_t> acked_bitrate_bps); |
+ const std::vector<PacketFeedback>& packet_feedback_vector); |
void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); |
bool LatestEstimate(std::vector<uint32_t>* ssrcs, |
uint32_t* bitrate_bps) const; |
@@ -58,11 +57,30 @@ |
int64_t GetExpectedBwePeriodMs() const; |
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); |
+ rtc::Optional<uint32_t> bitrate_bps() const; |
+ |
+ private: |
+ float UpdateWindow(int64_t now_ms, int bytes, int rate_window_ms); |
+ int sum_; |
+ int64_t current_win_ms_; |
+ int64_t prev_time_ms_; |
+ float bitrate_estimate_; |
+ float bitrate_estimate_var_; |
+ }; |
+ |
void IncomingPacketFeedback(const PacketFeedback& packet_feedback); |
Result OnLongFeedbackDelay(int64_t arrival_time_ms); |
- Result MaybeUpdateEstimate(bool overusing, |
- rtc::Optional<uint32_t> acked_bitrate_bps); |
+ Result MaybeUpdateEstimate(bool overusing); |
// Updates the current remote rate estimate and returns true if a valid |
// estimate exists. |
bool UpdateEstimate(int64_t now_ms, |
@@ -76,6 +94,7 @@ |
std::unique_ptr<InterArrival> inter_arrival_; |
std::unique_ptr<TrendlineEstimator> trendline_estimator_; |
OveruseDetector detector_; |
+ BitrateEstimator receiver_incoming_bitrate_; |
int64_t last_seen_packet_ms_; |
bool uma_recorded_; |
AimdRateControl rate_control_; |