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

Unified Diff: webrtc/base/ratetracker.cc

Issue 1582333008: Let a minimum time interval pass (one bucket size) after initialization before reporting rates (to … (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add unittest Created 4 years, 11 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
« no previous file with comments | « no previous file | webrtc/base/ratetracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/ratetracker.cc
diff --git a/webrtc/base/ratetracker.cc b/webrtc/base/ratetracker.cc
index 35521a8d3d47bd9aec2c9a8708a8dfefd56dfbb5..c1ad2d5e844a00b4b3842bdbcd9e31af83a36a3f 100644
--- a/webrtc/base/ratetracker.cc
+++ b/webrtc/base/ratetracker.cc
@@ -63,6 +63,10 @@ double RateTracker::ComputeRateForInterval(
milliseconds_to_skip = 0u;
available_interval_milliseconds =
TimeDiff(current_time, initialization_time_milliseconds_);
+ // Let one bucket interval pass after initialization before reporting.
+ if (available_interval_milliseconds < bucket_milliseconds_) {
+ return 0.0;
+ }
}
// If we're skipping all buckets that means that there have been no samples
// within the sampling interval so report 0.
« no previous file with comments | « no previous file | webrtc/base/ratetracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698