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

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: Minor changes 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..4f28557c60a0c9c595e8d24dc4c8705914e6d805 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 min_rtt, int64_t time_discovered) {
terelius 2017/07/12 10:34:51 Rename min_rtt to rtt? WDYT? Will time_discovered
gnish1 2017/07/12 12:23:18 Done.
+ if (!min_rtt_ || min_rtt <= *min_rtt_) {
+ min_rtt_.emplace(min_rtt);
+ discovery_time_ = time_discovered;
+ }
+ }
+ int64_t discovery_time() { return discovery_time_; }
// Checks whether or not last discovered min_rtt value is older than x
// seconds.
terelius 2017/07/12 10:34:51 Seconds or milliseconds?
gnish1 2017/07/12 12:23:18 Done.
- bool MinRttExpired(int64_t now);
- void set_min_rtt_discovery_time(int64_t discovery_time);
+ bool min_rtt_expired(int64_t now, int64_t min_rtt_filter_window_size_ms) {
terelius 2017/07/12 10:34:51 Please include units where appropriate, i.e. now_m
gnish1 2017/07/12 12:23:19 Done.
+ return now - discovery_time_ >= min_rtt_filter_window_size_ms;
+ }
+
+ private:
+ rtc::Optional<int64_t> min_rtt_;
+ int64_t discovery_time_ = 0;
};
} // namespace bwe
} // namespace testing

Powered by Google App Engine
This is Rietveld 408576698