Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Unified Diff: webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.cc

Issue 2982233002: Added implementations for entering/exiting STARTUP, DRAIN, PROBE_BW, PROBE_RTT modes, also updated M (Closed)
Patch Set: Unittest fix Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3d357704b582f892a7429125a87593fb2927921f 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_window.cc
@@ -19,29 +19,27 @@ namespace webrtc {
namespace testing {
namespace bwe {
namespace {
-// kStartingCongestionWindow is used to set congestion window when bandwidth
-// 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;
+// kStartingCongestionWindowBytes is used to set congestion window when
+// bandwidth 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 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 +51,20 @@ 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;
+ // If we have no rtt sample yet, return the starting congestion window size.
+ if (!min_rtt_ms)
+ return gain * kStartingCongestionWindowBytes;
+ int bdp = *min_rtt_ms * bandwidth_estimate_bps;
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

Powered by Google App Engine
This is Rietveld 408576698