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-Commit-Position: refs/heads/master@{#10592}
This commit is contained in:
Tim Psiaki
2015-11-10 16:34:50 -08:00
parent 9cafd97277
commit ad13d2f817
4 changed files with 11 additions and 9 deletions

View File

@ -73,8 +73,9 @@ double RateTracker::ComputeRateForInterval(
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);

View File

@ -1308,7 +1308,7 @@ uint32_t Connection::last_received() {
}
size_t Connection::recv_bytes_second() {
return recv_rate_tracker_.ComputeRate();
return round(recv_rate_tracker_.ComputeRate());
}
size_t Connection::recv_total_bytes() {
@ -1316,7 +1316,7 @@ size_t Connection::recv_total_bytes() {
}
size_t Connection::sent_bytes_second() {
return send_rate_tracker_.ComputeRate();
return round(send_rate_tracker_.ComputeRate());
}
size_t Connection::sent_total_bytes() {

View File

@ -44,9 +44,9 @@ void ReceiveStatisticsProxy::UpdateHistograms() {
int samples = static_cast<int>(render_fps_tracker_.TotalSampleCount());
if (samples > kMinRequiredSamples) {
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.RenderFramesPerSecond",
static_cast<int>(render_fps_tracker_.ComputeTotalRate()));
round(render_fps_tracker_.ComputeTotalRate()));
RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.RenderSqrtPixelsPerSecond",
static_cast<int>(render_pixel_tracker_.ComputeTotalRate()));
round(render_pixel_tracker_.ComputeTotalRate()));
}
int width = render_width_counter_.Avg(kMinRequiredSamples);
int height = render_height_counter_.Avg(kMinRequiredSamples);

View File

@ -11,6 +11,7 @@
#include "webrtc/video/send_statistics_proxy.h"
#include <algorithm>
#include <cmath>
#include <map>
#include "webrtc/base/checks.h"
@ -70,11 +71,11 @@ SendStatisticsProxy::~SendStatisticsProxy() {
void SendStatisticsProxy::UpdateHistograms() {
int input_fps =
static_cast<int>(input_frame_rate_tracker_.ComputeTotalRate());
round(input_frame_rate_tracker_.ComputeTotalRate());
if (input_fps > 0)
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.InputFramesPerSecond", input_fps);
int sent_fps =
static_cast<int>(sent_frame_rate_tracker_.ComputeTotalRate());
round(sent_frame_rate_tracker_.ComputeTotalRate());
if (sent_fps > 0)
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps);
@ -155,7 +156,7 @@ VideoSendStream::Stats SendStatisticsProxy::GetStats() {
rtc::CritScope lock(&crit_);
PurgeOldStats();
stats_.input_frame_rate =
static_cast<int>(input_frame_rate_tracker_.ComputeRate());
round(input_frame_rate_tracker_.ComputeRate());
return stats_;
}