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

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 1720883002: Move RTCP histograms from vie_channel to video channel stats proxies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
Index: webrtc/video/send_statistics_proxy.cc
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc
index 11dd241afaa05c41f90133f5917d7eb0476afdc0..06a761bab8caf23b20f4822634d29880f6dea89b 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -77,26 +77,34 @@ SendStatisticsProxy::SendStatisticsProxy(
content_type_(content_type),
last_sent_frame_timestamp_(0),
encode_time_(kEncodeTimeWeigthFactor),
- uma_container_(new UmaSamplesContainer(GetUmaPrefix(content_type_))) {
+ uma_container_(
+ new UmaSamplesContainer(GetUmaPrefix(content_type_), stats_, clock)) {
UpdateCodecTypeHistogram(config_.encoder_settings.payload_name);
}
-SendStatisticsProxy::~SendStatisticsProxy() {}
+SendStatisticsProxy::~SendStatisticsProxy() {
+ rtc::CritScope lock(&crit_);
+ uma_container_->UpdateHistograms(config_, stats_);
+}
SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer(
- const char* prefix)
+ const char* prefix,
+ const VideoSendStream::Stats& stats,
+ Clock* const clock)
: uma_prefix_(prefix),
max_sent_width_per_timestamp_(0),
max_sent_height_per_timestamp_(0),
input_frame_rate_tracker_(100u, 10u),
sent_frame_rate_tracker_(100u, 10u),
- first_rtcp_stats_time_ms_(-1) {}
+ clock_(clock),
+ first_rtcp_stats_time_ms_(-1),
+ start_stats_(stats) {}
-SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() {
- UpdateHistograms();
-}
+SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() {}
-void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() {
+void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
+ const VideoSendStream::Config& config,
+ const VideoSendStream::Stats& current_stats) {
RTC_DCHECK(uma_prefix_ == kRealtimePrefix || uma_prefix_ == kScreenPrefix);
const int kIndex = uma_prefix_ == kScreenPrefix ? 1 : 0;
const int kMinRequiredSamples = 200;
@@ -167,14 +175,45 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() {
RTC_HISTOGRAMS_COUNTS_100000(kIndex, uma_prefix_ + "SendSideDelayMaxInMs",
max_delay_ms);
}
+
int fraction_lost = report_block_stats_.FractionLostInPercent();
if (first_rtcp_stats_time_ms_ != -1) {
- int64_t elapsed_time_ms = Clock::GetRealTimeClock()->TimeInMilliseconds() -
- first_rtcp_stats_time_ms_;
- if (elapsed_time_ms / 1000 >= metrics::kMinRunTimeInSeconds &&
- fraction_lost != -1) {
- RTC_HISTOGRAMS_PERCENTAGE(
- kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost);
+ int64_t elapsed_sec =
+ (clock_->TimeInMilliseconds() - first_rtcp_stats_time_ms_) / 1000;
+ if (elapsed_sec >= metrics::kMinRunTimeInSeconds) {
+ if (fraction_lost != -1) {
+ RTC_HISTOGRAMS_PERCENTAGE(
+ kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost);
+ }
+
+ RtcpPacketTypeCounter counters;
+ for (uint32_t ssrc : config.rtp.ssrcs) {
+ auto it = current_stats.substreams.find(ssrc);
+ if (it == current_stats.substreams.end())
+ continue;
+
+ RtcpPacketTypeCounter stream_counters =
pbos-webrtc 2016/02/23 15:15:26 Comment here please.
sprang 2016/02/23 16:42:09 Done.
+ it->second.rtcp_packet_type_counts;
+ it = start_stats_.substreams.find(ssrc);
pbos-webrtc 2016/02/23 15:15:26 kv =
sprang 2016/02/23 16:42:09 Done.
+ if (it != start_stats_.substreams.end())
+ stream_counters.Subtract(it->second.rtcp_packet_type_counts);
+
+ counters.Add(stream_counters);
+ }
+ RTC_HISTOGRAMS_COUNTS_10000(kIndex,
+ uma_prefix_ + "NackPacketsReceivedPerMinute",
+ counters.nack_packets * 60 / elapsed_sec);
+ RTC_HISTOGRAMS_COUNTS_10000(kIndex,
+ uma_prefix_ + "FirPacketsReceivedPerMinute",
+ counters.fir_packets * 60 / elapsed_sec);
+ RTC_HISTOGRAMS_COUNTS_10000(kIndex,
+ uma_prefix_ + "PliPacketsReceivedPerMinute",
+ counters.pli_packets * 60 / elapsed_sec);
+ if (counters.nack_requests > 0) {
+ RTC_HISTOGRAMS_PERCENTAGE(
+ kIndex, uma_prefix_ + "UniqueNackRequestsReceivedInPercent",
+ counters.UniqueNackRequestsInPercent());
+ }
}
}
}
@@ -183,7 +222,9 @@ void SendStatisticsProxy::SetContentType(
VideoEncoderConfig::ContentType content_type) {
rtc::CritScope lock(&crit_);
if (content_type_ != content_type) {
- uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type)));
+ uma_container_->UpdateHistograms(config_, stats_);
+ uma_container_.reset(
+ new UmaSamplesContainer(GetUmaPrefix(content_type), stats_, clock_));
content_type_ = content_type;
}
}

Powered by Google App Engine
This is Rietveld 408576698