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

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

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/max_bandwidth_filter.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/max_bandwidth_filter.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/max_bandwidth_filter.cc
index 91e99346bfec2790ef81f031f84751aa78adb9f1..f6c883bbfb1f60fd3cb5f651a927d61d95e3e4dd 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/max_bandwidth_filter.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/max_bandwidth_filter.cc
@@ -14,10 +14,26 @@
namespace webrtc {
namespace testing {
namespace bwe {
-MaxBandwidthFilter::MaxBandwidthFilter() {}
+MaxBandwidthFilter::MaxBandwidthFilter()
+ : bandwidth_last_round_(0),
+ round_bandwidth_updated_(0),
+ max_bandwidth_estimate_(0),
+ rounds_without_growth_(0) {}
MaxBandwidthFilter::~MaxBandwidthFilter() {}
+// Rounds are units for packets rtt_time, after packet has been acknowledged,
+// one round has passed from its send time.
+void MaxBandwidthFilter::AddBandwidthSample(int64_t sample_bytes_per_ms,
+ int64_t round,
+ size_t filter_size_round) {
+ if (round - round_bandwidth_updated_ >= filter_size_round ||
+ sample_bytes_per_ms >= max_bandwidth_estimate_) {
+ max_bandwidth_estimate_ = sample_bytes_per_ms;
+ round_bandwidth_updated_ = round;
+ }
+}
+
bool MaxBandwidthFilter::FullBandwidthReached(float growth_target,
int max_rounds_without_growth) {
// Minimal bandwidth necessary to assume that better bandwidth can still be
@@ -29,9 +45,7 @@ bool MaxBandwidthFilter::FullBandwidthReached(float growth_target,
return false;
}
rounds_without_growth_++;
- if (rounds_without_growth_ >= max_rounds_without_growth)
- return true;
- return false;
+ return rounds_without_growth_ >= max_rounds_without_growth;
}
} // namespace bwe
} // namespace testing

Powered by Google App Engine
This is Rietveld 408576698