Round Rate computations from RateTracker. BUG=534221 R=asapersson@webrtc.org, pbos@webrtc.org, pthatcher@webrtc.org Review URL: https://codereview.webrtc.org/1410533004 . Cr-Original-Commit-Position: refs/heads/master@{#10592} Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc Cr-Mirrored-Commit: ad13d2f8178af5efbe516184995af02a171ec66a
diff --git a/base/ratetracker.cc b/base/ratetracker.cc index 5cb4490..35521a8 100644 --- a/base/ratetracker.cc +++ b/base/ratetracker.cc
@@ -73,8 +73,9 @@ size_t start_bucket = NextBucketIndex(current_bucket_ + buckets_to_skip); // Only count a portion of the first bucket according to how much of the // first bucket is within the current interval. - size_t total_samples = sample_buckets_[start_bucket] * - (bucket_milliseconds_ - milliseconds_to_skip) / + size_t total_samples = ((sample_buckets_[start_bucket] * + (bucket_milliseconds_ - milliseconds_to_skip)) + + (bucket_milliseconds_ >> 1)) / bucket_milliseconds_; // All other buckets in the interval are counted in their entirety. for (size_t i = NextBucketIndex(start_bucket);