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

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 1734933002: Move RTP stats histograms from VieChannel to SendStatisticsProxy. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Assert diff of RtpPacketCounter is valid Created 4 years, 10 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') | webrtc/video/send_statistics_proxy_unittest.cc » ('j') | 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 729c77535d27c3cbd492aa946f63d71687f314e6..6407cdc62ea8e2257994ef90291f60c81ec42294 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -98,10 +98,26 @@ SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer(
input_frame_rate_tracker_(100u, 10u),
sent_frame_rate_tracker_(100u, 10u),
first_rtcp_stats_time_ms_(-1),
+ first_rtp_stats_time_ms_(-1),
start_stats_(stats) {}
SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() {}
+void AccumulateRtpStats(const VideoSendStream::Stats& stats,
+ const VideoSendStream::Config& config,
+ StreamDataCounters* total_rtp_stats,
+ StreamDataCounters* rtx_stats) {
+ for (auto it : stats.substreams) {
+ const std::vector<uint32_t> rtx_ssrcs = config.rtp.rtx.ssrcs;
+ if (std::find(rtx_ssrcs.begin(), rtx_ssrcs.end(), it.first) !=
+ rtx_ssrcs.end()) {
+ rtx_stats->Add(it.second.rtp_stats);
+ } else {
+ total_rtp_stats->Add(it.second.rtp_stats);
+ }
+ }
+}
+
void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
const VideoSendStream::Config& config,
const VideoSendStream::Stats& current_stats) {
@@ -223,6 +239,51 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
}
}
}
+
+ if (first_rtp_stats_time_ms_ != -1) {
+ int64_t elapsed_sec =
+ (clock_->TimeInMilliseconds() - first_rtp_stats_time_ms_) / 1000;
+ if (elapsed_sec >= metrics::kMinRunTimeInSeconds) {
+ StreamDataCounters rtp;
+ StreamDataCounters rtx;
+ AccumulateRtpStats(current_stats, config, &rtp, &rtx);
+ StreamDataCounters start_rtp;
+ StreamDataCounters start_rtx;
+ AccumulateRtpStats(start_stats_, config, &start_rtp, &start_rtx);
+ rtp.Subtract(start_rtp);
+ rtx.Subtract(start_rtx);
+ StreamDataCounters rtp_rtx = rtp;
+ rtp_rtx.Add(rtx);
+
+ RTC_HISTOGRAMS_COUNTS_10000(
+ kIndex, uma_prefix_ + "BitrateSentInKbps",
+ static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
+ 1000));
+ RTC_HISTOGRAMS_COUNTS_10000(
+ kIndex, uma_prefix_ + "MediaBitrateSentInKbps",
+ static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
+ RTC_HISTOGRAMS_COUNTS_10000(
+ kIndex, uma_prefix_ + "PaddingBitrateSentInKbps",
+ static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
+ 1000));
+ RTC_HISTOGRAMS_COUNTS_10000(
+ kIndex, uma_prefix_ + "RetransmittedBitrateSentInKbps",
+ static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
+ elapsed_sec / 1000));
+ if (!config.rtp.rtx.ssrcs.empty()) {
+ RTC_HISTOGRAMS_COUNTS_10000(
+ kIndex, uma_prefix_ + "RtxBitrateSentInKbps",
+ static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
+ 1000));
+ }
+ if (config.rtp.fec.red_payload_type != -1) {
+ RTC_HISTOGRAMS_COUNTS_10000(kIndex,
+ uma_prefix_ + "FecBitrateSentInKbps",
+ static_cast<int>(rtp_rtx.fec.TotalBytes() *
+ 8 / elapsed_sec / 1000));
+ }
+ }
+ }
}
void SendStatisticsProxy::SetContentType(
@@ -429,6 +490,8 @@ void SendStatisticsProxy::DataCountersUpdated(
<< "DataCountersUpdated reported for unknown ssrc: " << ssrc;
stats->rtp_stats = counters;
+ if (uma_container_->first_rtp_stats_time_ms_ == -1)
+ uma_container_->first_rtp_stats_time_ms_ = clock_->TimeInMilliseconds();
}
void SendStatisticsProxy::Notify(const BitrateStatistics& total_stats,
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | webrtc/video/send_statistics_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698