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

Unified Diff: webrtc/modules/remote_bitrate_estimator/test/estimators/min_rtt_filter.h

Issue 2990163002: Almost full implementation of BBR's core. (Closed)
Patch Set: fixed patch failure Created 3 years, 4 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/min_rtt_filter.h
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/min_rtt_filter.h b/webrtc/modules/remote_bitrate_estimator/test/estimators/min_rtt_filter.h
index 8c9823c035f059e7509a13330ab7141c0ff5ff0f..b4932e51cad7e4e773ce41e3de67bff59aae7201 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/min_rtt_filter.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/min_rtt_filter.h
@@ -20,14 +20,19 @@
namespace webrtc {
namespace testing {
namespace bwe {
+
+// Expiration time for min_rtt sample, which is set to 10 seconds according to
+// BBR design doc.
+const int64_t kMinRttFilterSizeMs = 10000;
+
class MinRttFilter {
public:
MinRttFilter() {}
~MinRttFilter() {}
rtc::Optional<int64_t> min_rtt_ms() { return min_rtt_ms_; }
- void add_rtt_sample(int64_t rtt_ms, int64_t now_ms) {
- if (!min_rtt_ms_ || rtt_ms <= *min_rtt_ms_) {
+ void AddRttSample(int64_t rtt_ms, int64_t now_ms) {
+ if (!min_rtt_ms_ || rtt_ms <= *min_rtt_ms_ || MinRttExpired(now_ms)) {
min_rtt_ms_.emplace(rtt_ms);
discovery_time_ms_ = now_ms;
}
@@ -36,8 +41,8 @@ class MinRttFilter {
// Checks whether or not last discovered min_rtt value is older than x
// milliseconds.
- bool min_rtt_expired(int64_t now_ms, int64_t min_rtt_filter_window_size_ms) {
- return now_ms - discovery_time_ms_ >= min_rtt_filter_window_size_ms;
+ bool MinRttExpired(int64_t now_ms) {
+ return now_ms - discovery_time_ms_ >= kMinRttFilterSizeMs;
}
private:

Powered by Google App Engine
This is Rietveld 408576698