From f4ded682e913d56bbadf14a391ff3ba37a7419f5 Mon Sep 17 00:00:00 2001 From: ilnik Date: Wed, 30 Aug 2017 02:30:20 -0700 Subject: [PATCH] Add SentToInputFpsRatioPercent UMA metric on send side New metric is a ratio between SentFramesPerSecond and InputFramesPerSecond. It's needed to measure how much of input frames are actually sent. BUG=webrtc:8178 Review-Url: https://codereview.webrtc.org/3010723002 Cr-Commit-Position: refs/heads/master@{#19596} --- webrtc/video/send_statistics_proxy.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 3b97343522..bab495df80 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -189,6 +189,26 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms( << sent_fps.ToString(); } + if (in_fps.num_samples > kMinRequiredPeriodicSamples && + sent_fps.num_samples >= kMinRequiredPeriodicSamples) { + int in_fps_avg = in_fps.average; + if (in_fps_avg > 0) { + int sent_fps_avg = sent_fps.average; + int sent_to_in_fps_ratio_percent = + (100 * sent_fps_avg + in_fps_avg / 2) / in_fps_avg; + // If reported period is small, it may happen that sent_fps is larger than + // input_fps briefly on average. This should be treated as 100% sent to + // input ratio. + if (sent_to_in_fps_ratio_percent > 100) + sent_to_in_fps_ratio_percent = 100; + RTC_HISTOGRAMS_PERCENTAGE(kIndex, + uma_prefix_ + "SentToInputFpsRatioPercent", + sent_to_in_fps_ratio_percent); + LOG(LS_INFO) << uma_prefix_ << "SentToInputFpsRatioPercent " + << sent_to_in_fps_ratio_percent; + } + } + int encode_ms = encode_time_counter_.Avg(kMinRequiredMetricsSamples); if (encode_ms != -1) { RTC_HISTOGRAMS_COUNTS_1000(kIndex, uma_prefix_ + "EncodeTimeInMs",