Chromium Code Reviews

Unified Diff: webrtc/base/analytics/percentile_filter.h

Issue 2512693002: Implement Theil-Sen's method for fitting a line to noisy data (used in bandwidth estimation). (Closed)
Patch Set: Use PercentileFilter to find median slope Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | webrtc/modules/BUILD.gn » ('j') | webrtc/modules/congestion_controller/delay_based_bwe.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/analytics/percentile_filter.h
diff --git a/webrtc/base/analytics/percentile_filter.h b/webrtc/base/analytics/percentile_filter.h
index b3c8f8d1775f8df42b22b9a42d802ce454b9c1cb..e7486b747cd1819e7a326441f1b367224fb9a9af 100644
--- a/webrtc/base/analytics/percentile_filter.h
+++ b/webrtc/base/analytics/percentile_filter.h
@@ -35,7 +35,7 @@ class PercentileFilter {
// Remove one observation. The complexity of this operation is logarithmic in
// the size of the container.
stefan-webrtc 2016/11/28 13:01:58 Comment on what this returns
terelius 2016/12/02 16:45:52 Done.
- void Erase(const T& value);
+ bool Erase(const T& value);
// Get the percentile value. The complexity of this operation is constant.
T GetPercentileValue() const;
@@ -76,11 +76,11 @@ void PercentileFilter<T>::Insert(const T& value) {
}
template <typename T>
-void PercentileFilter<T>::Erase(const T& value) {
+bool PercentileFilter<T>::Erase(const T& value) {
typename std::multiset<T>::const_iterator it = set_.lower_bound(value);
// Ignore erase operation if the element is not present in the current set.
if (it == set_.end() || *it != value)
- return;
+ return false;
if (it == percentile_it_) {
// If same iterator, update to the following element. Index is not
// affected.
@@ -92,6 +92,7 @@ void PercentileFilter<T>::Erase(const T& value) {
--percentile_index_;
}
UpdatePercentileIterator();
+ return true;
}
template <typename T>
« no previous file with comments | « no previous file | webrtc/modules/BUILD.gn » ('j') | webrtc/modules/congestion_controller/delay_based_bwe.h » ('J')

Powered by Google App Engine