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

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

Issue 2966403002: Added implementation of three classes in BBR,with unit-tests. (Closed)
Patch Set: Changed names of some variables. 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/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 f41a4f0dad57ef9426094c4f51305649fa372e87..a6c649cba867b79257db77b80e386727d1786346 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
@@ -12,20 +12,37 @@
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_MIN_RTT_FILTER_H_
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_MIN_RTT_FILTER_H_
+#include <cstdint>
+#include <limits>
+
+#include "webrtc/rtc_base/optional.h"
+
namespace webrtc {
namespace testing {
namespace bwe {
class MinRttFilter {
public:
- MinRttFilter();
- ~MinRttFilter();
- int64_t min_rtt();
- void UpdateMinRtt(int64_t min_rtt);
+ MinRttFilter() {}
+ ~MinRttFilter() {}
+
+ rtc::Optional<int64_t> min_rtt() { return min_rtt_; }
+ void add_rtt_sample(int64_t rtt, int64_t now_ms) {
+ if (!min_rtt_ || rtt <= *min_rtt_) {
+ min_rtt_.emplace(rtt);
+ discovery_time_ms_ = now_ms;
+ }
+ }
+ int64_t discovery_time() { return discovery_time_ms_; }
// Checks whether or not last discovered min_rtt value is older than x
- // seconds.
- bool MinRttExpired(int64_t now);
- void set_min_rtt_discovery_time(int64_t discovery_time);
+ // 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;
+ }
+
+ private:
+ rtc::Optional<int64_t> min_rtt_;
+ int64_t discovery_time_ms_ = 0;
};
} // namespace bwe
} // namespace testing

Powered by Google App Engine
This is Rietveld 408576698