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 c6f48e21a853a3b254a6eb0c92a43f39c04af930..08b7cce49f39e6fbe5c694c3925b50c463d3268a 100644 |
| --- a/webrtc/video/send_statistics_proxy.cc |
| +++ b/webrtc/video/send_statistics_proxy.cc |
| @@ -10,6 +10,7 @@ |
| #include "webrtc/video/send_statistics_proxy.h" |
| +#include <algorithm> |
| #include <map> |
| #include "webrtc/base/checks.h" |
| @@ -24,7 +25,11 @@ const int SendStatisticsProxy::kStatsTimeoutMs = 5000; |
| SendStatisticsProxy::SendStatisticsProxy(Clock* clock, |
| const VideoSendStream::Config& config) |
| - : clock_(clock), config_(config), last_sent_frame_timestamp_(0) { |
| + : clock_(clock), |
| + config_(config), |
| + last_sent_frame_timestamp_(0), |
| + max_sent_width_per_timestamp_(0), |
| + max_sent_height_per_timestamp_(0) { |
| } |
| SendStatisticsProxy::~SendStatisticsProxy() { |
| @@ -34,13 +39,26 @@ SendStatisticsProxy::~SendStatisticsProxy() { |
| void SendStatisticsProxy::UpdateHistograms() { |
| int input_fps = |
| static_cast<int>(input_frame_rate_tracker_total_.units_second()); |
| - int sent_fps = |
| - static_cast<int>(sent_frame_rate_tracker_total_.units_second()); |
| - |
| 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()); |
| if (sent_fps > 0) |
| RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps); |
| + |
| + const int kMinRequiredSamples = 100; |
| + int in_width = input_width_counter_.Avg(kMinRequiredSamples); |
| + if (in_width != -1) |
|
pbos-webrtc
2015/07/20 13:52:22
Same here, treat in_{width,height} as one pair, an
åsapersson
2015/07/20 15:06:30
Done.
|
| + RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.InputWidthInPixels", in_width); |
| + int in_height = input_height_counter_.Avg(kMinRequiredSamples); |
| + if (in_height != -1) |
| + RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.InputHeightInPixels", in_height); |
| + int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); |
| + if (sent_width != -1) |
| + RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentWidthInPixels", sent_width); |
| + int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); |
| + if (sent_height != -1) |
| + RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentHeightInPixels", sent_height); |
| } |
| void SendStatisticsProxy::OutgoingRate(const int video_channel, |
| @@ -139,16 +157,28 @@ void SendStatisticsProxy::OnSendEncodedImage( |
| stats->width = encoded_image._encodedWidth; |
| stats->height = encoded_image._encodedHeight; |
| update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); |
| - if (encoded_image._timeStamp != last_sent_frame_timestamp_) { |
| - last_sent_frame_timestamp_ = encoded_image._timeStamp; |
| + |
| + if (last_sent_frame_timestamp_ > 0 && |
|
pbos-webrtc
2015/07/20 13:52:22
Write a TODO() saying that this is incorrect if si
åsapersson
2015/07/20 15:06:30
Done, added comment.
|
| + encoded_image._timeStamp != last_sent_frame_timestamp_) { |
| sent_frame_rate_tracker_total_.Update(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; |
| + max_sent_height_per_timestamp_ = 0; |
| } |
| + last_sent_frame_timestamp_ = encoded_image._timeStamp; |
| + max_sent_width_per_timestamp_ = std::max(max_sent_width_per_timestamp_, |
| + static_cast<int>(encoded_image._encodedWidth)); |
| + max_sent_height_per_timestamp_ = std::max(max_sent_height_per_timestamp_, |
| + static_cast<int>(encoded_image._encodedHeight)); |
| } |
| -void SendStatisticsProxy::OnIncomingFrame() { |
| +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_width_counter_.Add(width); |
| + input_height_counter_.Add(height); |
| } |
| void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( |