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

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

Issue 2999073002: Tweaked version of BBR for WebRTC. (Closed)
Patch Set: Updated according to comments. 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 b4932e51cad7e4e773ce41e3de67bff59aae7201..640bdab42b1c732d70f120d90634ed313f1d6097 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
@@ -14,6 +14,7 @@
#include <cstdint>
#include <limits>
+#include <list>
#include "webrtc/rtc_base/optional.h"
@@ -23,7 +24,8 @@ namespace bwe {
// Expiration time for min_rtt sample, which is set to 10 seconds according to
philipel 2017/08/18 11:22:15 Update comment
gnish1 2017/08/18 11:48:42 Done.
// BBR design doc.
-const int64_t kMinRttFilterSizeMs = 10000;
+const float kRttIncreaseThresholdForExpiry = 2.3f;
+const size_t kRttFilterSize = 25;
class MinRttFilter {
philipel 2017/08/18 11:22:15 Add a comment about what this class does, and why
gnish1 2017/08/18 11:48:43 Done.
public:
@@ -34,20 +36,31 @@ class MinRttFilter {
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;
}
+ rtt_samples_.push_back(rtt_ms);
+ if (rtt_samples_.size() > kRttFilterSize)
+ rtt_samples_.pop_front();
}
- int64_t discovery_time() { return discovery_time_ms_; }
// Checks whether or not last discovered min_rtt value is older than x
philipel 2017/08/18 11:22:15 Edit comment.
gnish1 2017/08/18 11:48:42 Done.
// milliseconds.
bool MinRttExpired(int64_t now_ms) {
- return now_ms - discovery_time_ms_ >= kMinRttFilterSizeMs;
+ if (rtt_samples_.size() < kRttFilterSize || !min_rtt_ms_)
+ return false;
+ int64_t sum_of_rtts_ms = 0;
+ for (int64_t i : rtt_samples_)
+ sum_of_rtts_ms += i;
+ if (sum_of_rtts_ms >=
+ *min_rtt_ms_ * kRttIncreaseThresholdForExpiry * kRttFilterSize) {
+ rtt_samples_.clear();
+ return true;
+ }
+ return false;
}
private:
rtc::Optional<int64_t> min_rtt_ms_;
- int64_t discovery_time_ms_ = 0;
+ std::list<int64_t> rtt_samples_;
};
} // namespace bwe
} // namespace testing

Powered by Google App Engine
This is Rietveld 408576698