Index: webrtc/video/send_statistics_proxy.cc |
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc |
index a6cb5b38e6bddd3d312f8c9b3d455acee9103cf6..c6f48e21a853a3b254a6eb0c92a43f39c04af930 100644 |
--- a/webrtc/video/send_statistics_proxy.cc |
+++ b/webrtc/video/send_statistics_proxy.cc |
@@ -16,6 +16,7 @@ |
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
#include "webrtc/system_wrappers/interface/logging.h" |
+#include "webrtc/system_wrappers/interface/metrics.h" |
namespace webrtc { |
@@ -23,11 +24,24 @@ const int SendStatisticsProxy::kStatsTimeoutMs = 5000; |
SendStatisticsProxy::SendStatisticsProxy(Clock* clock, |
const VideoSendStream::Config& config) |
- : clock_(clock), |
- config_(config) { |
+ : clock_(clock), config_(config), last_sent_frame_timestamp_(0) { |
} |
-SendStatisticsProxy::~SendStatisticsProxy() {} |
+SendStatisticsProxy::~SendStatisticsProxy() { |
+ UpdateHistograms(); |
+} |
+ |
+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); |
+ if (sent_fps > 0) |
+ RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps); |
+} |
void SendStatisticsProxy::OutgoingRate(const int video_channel, |
const unsigned int framerate, |
@@ -125,11 +139,16 @@ 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; |
+ sent_frame_rate_tracker_total_.Update(1); |
+ } |
} |
void SendStatisticsProxy::OnIncomingFrame() { |
rtc::CritScope lock(&crit_); |
input_frame_rate_tracker_.Update(1); |
+ input_frame_rate_tracker_total_.Update(1); |
} |
void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( |