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

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 1279433006: Add a rate tracker that tracks rate over a given interval split up into buckets that accumulate uni… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: New tests and readability fixes. Created 5 years, 3 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 | « webrtc/video/send_statistics_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/send_statistics_proxy.cc
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc
index 551b4b562a43904f6cfe1105d65455b2610126b9..e60614c9b653b30fd546e7deec1c4c875f0ea5b0 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -27,6 +27,8 @@ SendStatisticsProxy::SendStatisticsProxy(Clock* clock,
const VideoSendStream::Config& config)
: clock_(clock),
config_(config),
+ input_frame_rate_tracker_(100u, 10u),
+ sent_frame_rate_tracker_(100u, 10u),
last_sent_frame_timestamp_(0),
max_sent_width_per_timestamp_(0),
max_sent_height_per_timestamp_(0) {
@@ -38,11 +40,11 @@ SendStatisticsProxy::~SendStatisticsProxy() {
void SendStatisticsProxy::UpdateHistograms() {
int input_fps =
- static_cast<int>(input_frame_rate_tracker_total_.units_second());
+ static_cast<int>(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_total_.units_second());
+ static_cast<int>(sent_frame_rate_tracker_.ComputeTotalRate());
if (sent_fps > 0)
RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps);
@@ -89,7 +91,7 @@ VideoSendStream::Stats SendStatisticsProxy::GetStats() {
rtc::CritScope lock(&crit_);
PurgeOldStats();
stats_.input_frame_rate =
- static_cast<int>(input_frame_rate_tracker_.units_second());
+ static_cast<int>(input_frame_rate_tracker_.ComputeRate());
return stats_;
}
@@ -167,7 +169,7 @@ void SendStatisticsProxy::OnSendEncodedImage(
// are encoded before the next start.
if (last_sent_frame_timestamp_ > 0 &&
encoded_image._timeStamp != last_sent_frame_timestamp_) {
- sent_frame_rate_tracker_total_.Update(1);
+ sent_frame_rate_tracker_.AddSamples(1);
sent_width_counter_.Add(max_sent_width_per_timestamp_);
sent_height_counter_.Add(max_sent_height_per_timestamp_);
max_sent_width_per_timestamp_ = 0;
@@ -184,8 +186,7 @@ void SendStatisticsProxy::OnSendEncodedImage(
void SendStatisticsProxy::OnIncomingFrame(int width, int height) {
rtc::CritScope lock(&crit_);
- input_frame_rate_tracker_.Update(1);
- input_frame_rate_tracker_total_.Update(1);
+ input_frame_rate_tracker_.AddSamples(1);
input_width_counter_.Add(width);
input_height_counter_.Add(height);
}
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698