Chromium Code Reviews| Index: webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.cc |
| diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.cc |
| index a52d17d7111e7d3d4084ab7bf4f61477140a7d5e..139b2ebc62c21ccf97e13cd3f847c0b99b36c871 100644 |
| --- a/webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.cc |
| +++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.cc |
| @@ -23,25 +23,22 @@ namespace { |
| // delay product is equal to zero, so that we don't set window to zero as well. |
| // Chosen randomly by me, because this value shouldn't make any significant |
| // difference, as bandwidth delay product is more than zero almost every time. |
| -const int kStartingCongestionWindow = 6000; |
| -// Size of congestion window while in PROBE_RTT mode, suggested by BBR's source |
| -// code of QUIC's implementation. |
| -const int kMinimumCongestionWindow = 5840; |
| +const int kStartingCongestionWindowBytes = 6000; |
| } // namespace |
| +const int CongestionWindow::kMinimumCongestionWindowBytes; |
| + |
| CongestionWindow::CongestionWindow() : data_inflight_bytes_(0) {} |
| CongestionWindow::~CongestionWindow() {} |
| -int CongestionWindow::GetCongestionWindow( |
| - BbrBweSender::Mode mode, |
| - int64_t bandwidth_estimate_bytes_per_ms, |
| - int64_t min_rtt_ms, |
| - float gain) { |
| +int CongestionWindow::GetCongestionWindow(BbrBweSender::Mode mode, |
| + int64_t bandwidth_estimate_bps, |
| + rtc::Optional<int64_t> min_rtt_ms, |
| + float gain) { |
| if (mode == BbrBweSender::PROBE_RTT) |
| - return kMinimumCongestionWindow; |
| - return GetTargetCongestionWindow(bandwidth_estimate_bytes_per_ms, min_rtt_ms, |
| - gain); |
| + return CongestionWindow::kMinimumCongestionWindowBytes; |
| + return GetTargetCongestionWindow(bandwidth_estimate_bps, min_rtt_ms, gain); |
| } |
| void CongestionWindow::PacketSent(size_t sent_packet_size_bytes) { |
| @@ -53,16 +50,17 @@ void CongestionWindow::AckReceived(size_t received_packet_size_bytes) { |
| } |
| int CongestionWindow::GetTargetCongestionWindow( |
| - int64_t bandwidth_estimate_bytes_per_ms, |
| - int64_t min_rtt_ms, |
| + int64_t bandwidth_estimate_bps, |
| + rtc::Optional<int64_t> min_rtt_ms, |
| float gain) { |
| - int bdp = min_rtt_ms * bandwidth_estimate_bytes_per_ms; |
| + int bdp = *min_rtt_ms * bandwidth_estimate_bps; |
|
philipel
2017/07/27 09:15:28
|min_rtt_ms| is an Optional but you assume it is a
gnish1
2017/07/27 11:24:25
Done.
|
| int congestion_window = bdp * gain; |
| // Congestion window could be zero in rare cases, when either no bandwidth |
| // estimate is available, or path's min_rtt value is zero. |
| if (!congestion_window) |
| - congestion_window = gain * kStartingCongestionWindow; |
| - return std::max(congestion_window, kMinimumCongestionWindow); |
| + congestion_window = gain * kStartingCongestionWindowBytes; |
| + return std::max(congestion_window, |
| + CongestionWindow::kMinimumCongestionWindowBytes); |
| } |
| } // namespace bwe |
| } // namespace testing |