Chromium Code Reviews| 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..90f3ea6758a49a4507537cdcf4848d74e939896f 100644 |
| --- a/webrtc/video/send_statistics_proxy.cc |
| +++ b/webrtc/video/send_statistics_proxy.cc |
| @@ -22,11 +22,16 @@ |
| namespace webrtc { |
| const int SendStatisticsProxy::kStatsTimeoutMs = 5000; |
| +const size_t SendStatisticsProxy::kFrameRateTrackerInterval = |
| + kStatsTimeoutMs / 1000; |
| SendStatisticsProxy::SendStatisticsProxy(Clock* clock, |
| const VideoSendStream::Config& config) |
| : clock_(clock), |
| config_(config), |
| + input_frame_rate_tracker_(kFrameRateTrackerInterval), |
| + input_frame_rate_tracker_total_(kFrameRateTrackerInterval), |
| + sent_frame_rate_tracker_total_(kFrameRateTrackerInterval), |
| last_sent_frame_timestamp_(0), |
| max_sent_width_per_timestamp_(0), |
| max_sent_height_per_timestamp_(0) { |
| @@ -38,11 +43,13 @@ 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_total_.ComputeCurrentRate( |
| + kFrameRateTrackerInterval * 1000u)); |
|
åsapersson
2015/08/28 08:12:47
input_fps and sent_fps below are an average over t
pbos-webrtc
2015/08/28 12:47:55
Can you add support for a ComputeTotalRate() or so
tpsiaki
2015/09/01 20:59:17
Done.
|
| 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_total_.ComputeCurrentRate( |
| + kFrameRateTrackerInterval * 1000u)); |
| if (sent_fps > 0) |
| RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps); |
| @@ -89,7 +96,8 @@ 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_.ComputeCurrentRate( |
| + kFrameRateTrackerInterval * 1000u)); |
| return stats_; |
| } |
| @@ -167,7 +175,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_total_.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 +192,8 @@ 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_frame_rate_tracker_total_.AddSamples(1); |
| input_width_counter_.Add(width); |
| input_height_counter_.Add(height); |
| } |