From f040b2367d894345677192f924590309be8c72fc Mon Sep 17 00:00:00 2001 From: asapersson Date: Wed, 4 Nov 2015 00:59:03 -0800 Subject: Add histograms for send-side delay stats for a sent video stream: - "WebRTC.Video.SendSideDelayInMs" - "WebRTC.Video.SendSideDelayMaxInMs" BUG=chromium:512752 Review URL: https://codereview.webrtc.org/1405023014 Cr-Commit-Position: refs/heads/master@{#10502} --- webrtc/video/send_statistics_proxy.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'webrtc/video/send_statistics_proxy.cc') diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 5be9970583..916ffb3baa 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -121,6 +121,15 @@ void SendStatisticsProxy::UpdateHistograms() { RTC_HISTOGRAM_ENUMERATION( "WebRTC.Video.BandwidthLimitedResolutionsDisabled", num_disabled, 10); } + int delay_ms = delay_counter_.Avg(kMinRequiredSamples); + if (delay_ms != -1) + RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.SendSideDelayInMs", delay_ms); + + int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); + if (max_delay_ms != -1) { + RTC_HISTOGRAM_COUNTS_100000( + "WebRTC.Video.SendSideDelayMaxInMs", max_delay_ms); + } } void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { @@ -337,6 +346,9 @@ void SendStatisticsProxy::SendSideDelayUpdated(int avg_delay_ms, return; stats->avg_delay_ms = avg_delay_ms; stats->max_delay_ms = max_delay_ms; + + delay_counter_.Add(avg_delay_ms); + max_delay_counter_.Add(max_delay_ms); } void SendStatisticsProxy::SampleCounter::Add(int sample) { -- cgit v1.2.3 From ad13d2f8178af5efbe516184995af02a171ec66a Mon Sep 17 00:00:00 2001 From: Tim Psiaki Date: Tue, 10 Nov 2015 16:34:50 -0800 Subject: Round Rate computations from RateTracker. BUG=534221 R=asapersson@webrtc.org, pbos@webrtc.org, pthatcher@webrtc.org Review URL: https://codereview.webrtc.org/1410533004 . Cr-Commit-Position: refs/heads/master@{#10592} --- webrtc/video/send_statistics_proxy.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'webrtc/video/send_statistics_proxy.cc') diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 916ffb3baa..57189f3175 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -11,6 +11,7 @@ #include "webrtc/video/send_statistics_proxy.h" #include +#include #include #include "webrtc/base/checks.h" @@ -70,11 +71,11 @@ SendStatisticsProxy::~SendStatisticsProxy() { void SendStatisticsProxy::UpdateHistograms() { int input_fps = - static_cast(input_frame_rate_tracker_.ComputeTotalRate()); + round(input_frame_rate_tracker_.ComputeTotalRate()); if (input_fps > 0) RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.InputFramesPerSecond", input_fps); int sent_fps = - static_cast(sent_frame_rate_tracker_.ComputeTotalRate()); + round(sent_frame_rate_tracker_.ComputeTotalRate()); if (sent_fps > 0) RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps); @@ -155,7 +156,7 @@ VideoSendStream::Stats SendStatisticsProxy::GetStats() { rtc::CritScope lock(&crit_); PurgeOldStats(); stats_.input_frame_rate = - static_cast(input_frame_rate_tracker_.ComputeRate()); + round(input_frame_rate_tracker_.ComputeRate()); return stats_; } -- cgit v1.2.3 From 6f14be8df8b67feb480f55b3a41e2b8cd06a836d Mon Sep 17 00:00:00 2001 From: asapersson Date: Mon, 16 Nov 2015 00:40:49 -0800 Subject: Add limit for minimum number of required samples before recording input and sent framerate stats. BUG= Review URL: https://codereview.webrtc.org/1446443002 Cr-Commit-Position: refs/heads/master@{#10644} --- webrtc/video/send_statistics_proxy.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'webrtc/video/send_statistics_proxy.cc') diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 57189f3175..5c2052a207 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -70,27 +70,22 @@ SendStatisticsProxy::~SendStatisticsProxy() { } void SendStatisticsProxy::UpdateHistograms() { - int input_fps = - round(input_frame_rate_tracker_.ComputeTotalRate()); - if (input_fps > 0) - RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.InputFramesPerSecond", input_fps); - int sent_fps = - round(sent_frame_rate_tracker_.ComputeTotalRate()); - if (sent_fps > 0) - RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps); - const int kMinRequiredSamples = 200; int in_width = input_width_counter_.Avg(kMinRequiredSamples); int in_height = input_height_counter_.Avg(kMinRequiredSamples); + int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); if (in_width != -1) { RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.InputWidthInPixels", in_width); RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.InputHeightInPixels", in_height); + RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.InputFramesPerSecond", in_fps); } int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); + int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate()); if (sent_width != -1) { RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentWidthInPixels", sent_width); RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentHeightInPixels", sent_height); + RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps); } int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); if (encode_ms != -1) -- cgit v1.2.3 From b4a1ae5299fd57be66c7cbb7a982179bb1ecfb90 Mon Sep 17 00:00:00 2001 From: sprang Date: Thu, 3 Dec 2015 08:10:08 -0800 Subject: Add separate send-side UMA stats for screenshare and video. This CL duplicates all the histograms in SendStatisticsProxy. Might be overkill, but we don't know which stats will be interesting and it makes the change easier. BUG= Review URL: https://codereview.webrtc.org/1433393002 Cr-Commit-Position: refs/heads/master@{#10885} --- webrtc/video/send_statistics_proxy.cc | 131 +++++++++++++++++++++------------- 1 file changed, 82 insertions(+), 49 deletions(-) (limited to 'webrtc/video/send_statistics_proxy.cc') diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 5c2052a207..8dd91d90f4 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -31,6 +31,17 @@ enum HistogramCodecType { kVideoMax = 64, }; +const char* GetUmaPrefix(VideoEncoderConfig::ContentType content_type) { + switch (content_type) { + case VideoEncoderConfig::ContentType::kRealtimeVideo: + return "WebRTC.Video."; + case VideoEncoderConfig::ContentType::kScreen: + return "WebRTC.Video.Screenshare."; + } + RTC_NOTREACHED(); + return nullptr; +} + HistogramCodecType PayloadNameToHistogramCodecType( const std::string& payload_name) { if (payload_name == "VP8") { @@ -53,78 +64,98 @@ void UpdateCodecTypeHistogram(const std::string& payload_name) { const int SendStatisticsProxy::kStatsTimeoutMs = 5000; -SendStatisticsProxy::SendStatisticsProxy(Clock* clock, - const VideoSendStream::Config& config) +SendStatisticsProxy::SendStatisticsProxy( + Clock* clock, + const VideoSendStream::Config& config, + VideoEncoderConfig::ContentType content_type) : clock_(clock), config_(config), - input_frame_rate_tracker_(100u, 10u), - sent_frame_rate_tracker_(100u, 10u), + content_type_(content_type), last_sent_frame_timestamp_(0), - max_sent_width_per_timestamp_(0), - max_sent_height_per_timestamp_(0) { + uma_container_(new UmaSamplesContainer(GetUmaPrefix(content_type_))) { UpdateCodecTypeHistogram(config_.encoder_settings.payload_name); } -SendStatisticsProxy::~SendStatisticsProxy() { +SendStatisticsProxy::~SendStatisticsProxy() {} + +SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( + const char* prefix) + : 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) {} + +SendStatisticsProxy::UmaSamplesContainer::~UmaSamplesContainer() { UpdateHistograms(); } -void SendStatisticsProxy::UpdateHistograms() { +void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() { const int kMinRequiredSamples = 200; int in_width = input_width_counter_.Avg(kMinRequiredSamples); int in_height = input_height_counter_.Avg(kMinRequiredSamples); int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); if (in_width != -1) { - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.InputWidthInPixels", in_width); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.InputHeightInPixels", in_height); - RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.InputFramesPerSecond", in_fps); + RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputWidthInPixels", in_width); + RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputHeightInPixels", in_height); + RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "InputFramesPerSecond", in_fps); } int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate()); if (sent_width != -1) { - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentWidthInPixels", sent_width); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentHeightInPixels", sent_height); - RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps); + RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentWidthInPixels", sent_width); + RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentHeightInPixels", sent_height); + RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "SentFramesPerSecond", sent_fps); } int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); if (encode_ms != -1) - RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms); + RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms); int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); if (key_frames_permille != -1) { - RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesSentInPermille", - key_frames_permille); + RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "KeyFramesSentInPermille", + key_frames_permille); } int quality_limited = quality_limited_frame_counter_.Percent(kMinRequiredSamples); if (quality_limited != -1) { - RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.QualityLimitedResolutionInPercent", + RTC_HISTOGRAM_PERCENTAGE(uma_prefix_ + "QualityLimitedResolutionInPercent", quality_limited); } int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); if (downscales != -1) { - RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.QualityLimitedResolutionDownscales", - downscales, 20); + RTC_HISTOGRAM_ENUMERATION( + uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20); } int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); if (bw_limited != -1) { - RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BandwidthLimitedResolutionInPercent", - bw_limited); + RTC_HISTOGRAM_PERCENTAGE( + uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited); } int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); if (num_disabled != -1) { RTC_HISTOGRAM_ENUMERATION( - "WebRTC.Video.BandwidthLimitedResolutionsDisabled", num_disabled, 10); + uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10); } int delay_ms = delay_counter_.Avg(kMinRequiredSamples); if (delay_ms != -1) - RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.SendSideDelayInMs", delay_ms); + RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayInMs", delay_ms); int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); if (max_delay_ms != -1) { - RTC_HISTOGRAM_COUNTS_100000( - "WebRTC.Video.SendSideDelayMaxInMs", max_delay_ms); + RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayMaxInMs", + max_delay_ms); + } +} + +void SendStatisticsProxy::SetContentType( + VideoEncoderConfig::ContentType content_type) { + rtc::CritScope lock(&crit_); + if (content_type_ != content_type) { + uma_container_->UpdateHistograms(); + uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type))); + content_type_ = content_type; } } @@ -151,7 +182,7 @@ VideoSendStream::Stats SendStatisticsProxy::GetStats() { rtc::CritScope lock(&crit_); PurgeOldStats(); stats_.input_frame_rate = - round(input_frame_rate_tracker_.ComputeRate()); + round(uma_container_->input_frame_rate_tracker_.ComputeRate()); return stats_; } @@ -224,23 +255,24 @@ void SendStatisticsProxy::OnSendEncodedImage( stats->height = encoded_image._encodedHeight; update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); - key_frame_counter_.Add(encoded_image._frameType == kVideoFrameKey); + uma_container_->key_frame_counter_.Add(encoded_image._frameType == + kVideoFrameKey); if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) { bool downscaled = encoded_image.adapt_reason_.quality_resolution_downscales > 0; - quality_limited_frame_counter_.Add(downscaled); + uma_container_->quality_limited_frame_counter_.Add(downscaled); if (downscaled) { - quality_downscales_counter_.Add( + uma_container_->quality_downscales_counter_.Add( encoded_image.adapt_reason_.quality_resolution_downscales); } } if (encoded_image.adapt_reason_.bw_resolutions_disabled != -1) { bool bw_limited = encoded_image.adapt_reason_.bw_resolutions_disabled > 0; - bw_limited_frame_counter_.Add(bw_limited); + uma_container_->bw_limited_frame_counter_.Add(bw_limited); if (bw_limited) { - bw_resolutions_disabled_counter_.Add( - encoded_image.adapt_reason_.bw_resolutions_disabled); + uma_container_->bw_resolutions_disabled_counter_.Add( + encoded_image.adapt_reason_.bw_resolutions_disabled); } } @@ -249,31 +281,33 @@ void SendStatisticsProxy::OnSendEncodedImage( // are encoded before the next start. if (last_sent_frame_timestamp_ > 0 && encoded_image._timeStamp != last_sent_frame_timestamp_) { - sent_frame_rate_tracker_.AddSamples(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; + uma_container_->sent_frame_rate_tracker_.AddSamples(1); + uma_container_->sent_width_counter_.Add( + uma_container_->max_sent_width_per_timestamp_); + uma_container_->sent_height_counter_.Add( + uma_container_->max_sent_height_per_timestamp_); + uma_container_->max_sent_width_per_timestamp_ = 0; + uma_container_->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_, + uma_container_->max_sent_width_per_timestamp_ = + std::max(uma_container_->max_sent_width_per_timestamp_, static_cast(encoded_image._encodedWidth)); - max_sent_height_per_timestamp_ = - std::max(max_sent_height_per_timestamp_, + uma_container_->max_sent_height_per_timestamp_ = + std::max(uma_container_->max_sent_height_per_timestamp_, static_cast(encoded_image._encodedHeight)); } void SendStatisticsProxy::OnIncomingFrame(int width, int height) { rtc::CritScope lock(&crit_); - input_frame_rate_tracker_.AddSamples(1); - input_width_counter_.Add(width); - input_height_counter_.Add(height); + uma_container_->input_frame_rate_tracker_.AddSamples(1); + uma_container_->input_width_counter_.Add(width); + uma_container_->input_height_counter_.Add(height); } void SendStatisticsProxy::OnEncodedFrame(int encode_time_ms) { rtc::CritScope lock(&crit_); - encode_time_counter_.Add(encode_time_ms); + uma_container_->encode_time_counter_.Add(encode_time_ms); } void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( @@ -343,8 +377,8 @@ void SendStatisticsProxy::SendSideDelayUpdated(int avg_delay_ms, stats->avg_delay_ms = avg_delay_ms; stats->max_delay_ms = max_delay_ms; - delay_counter_.Add(avg_delay_ms); - max_delay_counter_.Add(max_delay_ms); + uma_container_->delay_counter_.Add(avg_delay_ms); + uma_container_->max_delay_counter_.Add(max_delay_ms); } void SendStatisticsProxy::SampleCounter::Add(int sample) { @@ -380,5 +414,4 @@ int SendStatisticsProxy::BoolSampleCounter::Fraction( return -1; return static_cast((sum * multiplier / num_samples) + 0.5f); } - } // namespace webrtc -- cgit v1.2.3 From 1aa420b6aa70bd97cbe33e396e5dc0346aeb6415 Mon Sep 17 00:00:00 2001 From: asapersson Date: Mon, 7 Dec 2015 03:12:22 -0800 Subject: Remove avg encode time from CpuOveruseMetric struct and use value from OnEncodedFrame instead. BUG= Review URL: https://codereview.webrtc.org/1278383002 Cr-Commit-Position: refs/heads/master@{#10911} --- webrtc/video/send_statistics_proxy.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'webrtc/video/send_statistics_proxy.cc') diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 8dd91d90f4..57d38a523b 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -15,13 +15,14 @@ #include #include "webrtc/base/checks.h" - #include "webrtc/base/logging.h" #include "webrtc/system_wrappers/include/critical_section_wrapper.h" #include "webrtc/system_wrappers/include/metrics.h" namespace webrtc { namespace { +const float kEncodeTimeWeigthFactor = 0.5f; + // Used by histograms. Values of entries should not be changed. enum HistogramCodecType { kVideoUnknown = 0, @@ -72,6 +73,7 @@ SendStatisticsProxy::SendStatisticsProxy( config_(config), content_type_(content_type), last_sent_frame_timestamp_(0), + encode_time_(kEncodeTimeWeigthFactor), uma_container_(new UmaSamplesContainer(GetUmaPrefix(content_type_))) { UpdateCodecTypeHistogram(config_.encoder_settings.payload_name); } @@ -168,8 +170,6 @@ void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { void SendStatisticsProxy::CpuOveruseMetricsUpdated( const CpuOveruseMetrics& metrics) { rtc::CritScope lock(&crit_); - // TODO(asapersson): Change to use OnEncodedFrame() for avg_encode_time_ms. - stats_.avg_encode_time_ms = metrics.avg_encode_time_ms; stats_.encode_usage_percent = metrics.encode_usage_percent; } @@ -308,6 +308,8 @@ void SendStatisticsProxy::OnIncomingFrame(int width, int height) { void SendStatisticsProxy::OnEncodedFrame(int encode_time_ms) { rtc::CritScope lock(&crit_); uma_container_->encode_time_counter_.Add(encode_time_ms); + encode_time_.Apply(1.0f, encode_time_ms); + stats_.avg_encode_time_ms = round(encode_time_.filtered()); } void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( -- cgit v1.2.3 From 17821db19702aca15d0d93cb60515ca70823fad7 Mon Sep 17 00:00:00 2001 From: asapersson Date: Mon, 14 Dec 2015 02:08:12 -0800 Subject: Wire up bandwidth limitation info to GetStats and adapt_reason. The input resolution (output from video_adapter) can be further scaled down or higher video layer(s) can be dropped due to bitrate constraints. BUG=webrtc:4112 Review URL: https://codereview.webrtc.org/1502173002 Cr-Commit-Position: refs/heads/master@{#11006} --- webrtc/video/send_statistics_proxy.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'webrtc/video/send_statistics_proxy.cc') diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 57d38a523b..f5e7e3d024 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -258,6 +258,10 @@ void SendStatisticsProxy::OnSendEncodedImage( uma_container_->key_frame_counter_.Add(encoded_image._frameType == kVideoFrameKey); + stats_.bw_limited_resolution = + encoded_image.adapt_reason_.quality_resolution_downscales > 0 || + encoded_image.adapt_reason_.bw_resolutions_disabled > 0; + if (encoded_image.adapt_reason_.quality_resolution_downscales != -1) { bool downscaled = encoded_image.adapt_reason_.quality_resolution_downscales > 0; -- cgit v1.2.3 From b7d9a97ce41022e984348efb5f28bf6dd6c6b779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= Date: Fri, 18 Dec 2015 16:01:11 +0100 Subject: Expose codec implementation names in stats. Used to distinguish between software/hardware encoders/decoders and other implementation differences. Useful for tracking quality regressions related to specific implementations. BUG=webrtc:4897 R=hta@webrtc.org, mflodman@webrtc.org, stefan@webrtc.org Review URL: https://codereview.webrtc.org/1406903002 . Cr-Commit-Position: refs/heads/master@{#11084} --- webrtc/video/send_statistics_proxy.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'webrtc/video/send_statistics_proxy.cc') diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index f5e7e3d024..c198ad2f8a 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -161,6 +161,12 @@ void SendStatisticsProxy::SetContentType( } } +void SendStatisticsProxy::OnEncoderImplementationName( + const char* implementation_name) { + rtc::CritScope lock(&crit_); + stats_.encoder_implementation_name = implementation_name; +} + void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { rtc::CritScope lock(&crit_); stats_.encode_frame_rate = framerate; -- cgit v1.2.3 From 53805324c0fa904d796cc0b333868c591f2c5f2c Mon Sep 17 00:00:00 2001 From: asapersson Date: Mon, 21 Dec 2015 01:46:20 -0800 Subject: Rename RTC_HISTOGRAM_* macros to RTC_HISTOGRAM_*_SPARSE_* to indicate that these are for infrequent updates. This implementation will be replaced by a faster one and sparse will be removed. BUG=webrtc:5283 Review URL: https://codereview.webrtc.org/1530913002 Cr-Commit-Position: refs/heads/master@{#11099} --- webrtc/video/send_statistics_proxy.cc | 43 ++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'webrtc/video/send_statistics_proxy.cc') diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index c198ad2f8a..0a84439825 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -57,7 +57,7 @@ HistogramCodecType PayloadNameToHistogramCodecType( } void UpdateCodecTypeHistogram(const std::string& payload_name) { - RTC_HISTOGRAM_ENUMERATION("WebRTC.Video.Encoder.CodecType", + RTC_HISTOGRAM_ENUMERATION_SPARSE("WebRTC.Video.Encoder.CodecType", PayloadNameToHistogramCodecType(payload_name), kVideoMax); } } // namespace @@ -98,56 +98,63 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms() { int in_height = input_height_counter_.Avg(kMinRequiredSamples); int in_fps = round(input_frame_rate_tracker_.ComputeTotalRate()); if (in_width != -1) { - RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputWidthInPixels", in_width); - RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "InputHeightInPixels", in_height); - RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "InputFramesPerSecond", in_fps); + RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "InputWidthInPixels", + in_width); + RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "InputHeightInPixels", + in_height); + RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix_ + "InputFramesPerSecond", + in_fps); } int sent_width = sent_width_counter_.Avg(kMinRequiredSamples); int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); int sent_fps = round(sent_frame_rate_tracker_.ComputeTotalRate()); if (sent_width != -1) { - RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentWidthInPixels", sent_width); - RTC_HISTOGRAM_COUNTS_10000(uma_prefix_ + "SentHeightInPixels", sent_height); - RTC_HISTOGRAM_COUNTS_100(uma_prefix_ + "SentFramesPerSecond", sent_fps); + RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "SentWidthInPixels", + sent_width); + RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix_ + "SentHeightInPixels", + sent_height); + RTC_HISTOGRAM_COUNTS_SPARSE_100(uma_prefix_ + "SentFramesPerSecond", + sent_fps); } int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); if (encode_ms != -1) - RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms); + RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "EncodeTimeInMs", encode_ms); int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples); if (key_frames_permille != -1) { - RTC_HISTOGRAM_COUNTS_1000(uma_prefix_ + "KeyFramesSentInPermille", - key_frames_permille); + RTC_HISTOGRAM_COUNTS_SPARSE_1000(uma_prefix_ + "KeyFramesSentInPermille", + key_frames_permille); } int quality_limited = quality_limited_frame_counter_.Percent(kMinRequiredSamples); if (quality_limited != -1) { - RTC_HISTOGRAM_PERCENTAGE(uma_prefix_ + "QualityLimitedResolutionInPercent", - quality_limited); + RTC_HISTOGRAM_PERCENTAGE_SPARSE( + uma_prefix_ + "QualityLimitedResolutionInPercent", quality_limited); } int downscales = quality_downscales_counter_.Avg(kMinRequiredSamples); if (downscales != -1) { - RTC_HISTOGRAM_ENUMERATION( + RTC_HISTOGRAM_ENUMERATION_SPARSE( uma_prefix_ + "QualityLimitedResolutionDownscales", downscales, 20); } int bw_limited = bw_limited_frame_counter_.Percent(kMinRequiredSamples); if (bw_limited != -1) { - RTC_HISTOGRAM_PERCENTAGE( + RTC_HISTOGRAM_PERCENTAGE_SPARSE( uma_prefix_ + "BandwidthLimitedResolutionInPercent", bw_limited); } int num_disabled = bw_resolutions_disabled_counter_.Avg(kMinRequiredSamples); if (num_disabled != -1) { - RTC_HISTOGRAM_ENUMERATION( + RTC_HISTOGRAM_ENUMERATION_SPARSE( uma_prefix_ + "BandwidthLimitedResolutionsDisabled", num_disabled, 10); } int delay_ms = delay_counter_.Avg(kMinRequiredSamples); if (delay_ms != -1) - RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayInMs", delay_ms); + RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayInMs", + delay_ms); int max_delay_ms = max_delay_counter_.Avg(kMinRequiredSamples); if (max_delay_ms != -1) { - RTC_HISTOGRAM_COUNTS_100000(uma_prefix_ + "SendSideDelayMaxInMs", - max_delay_ms); + RTC_HISTOGRAM_COUNTS_SPARSE_100000(uma_prefix_ + "SendSideDelayMaxInMs", + max_delay_ms); } } -- cgit v1.2.3 From 59bac1a4c557bb4ba4e5f9f2f6db6040ae4b41a7 Mon Sep 17 00:00:00 2001 From: asapersson Date: Thu, 7 Jan 2016 23:36:00 -0800 Subject: Fix for stats updated twice when switching content type (realtime <-> screenshare). Add unittest. BUG= Review URL: https://codereview.webrtc.org/1543933004 Cr-Commit-Position: refs/heads/master@{#11180} --- webrtc/video/send_statistics_proxy.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'webrtc/video/send_statistics_proxy.cc') diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc index 0a84439825..d2964b21da 100644 --- a/webrtc/video/send_statistics_proxy.cc +++ b/webrtc/video/send_statistics_proxy.cc @@ -162,7 +162,6 @@ void SendStatisticsProxy::SetContentType( VideoEncoderConfig::ContentType content_type) { rtc::CritScope lock(&crit_); if (content_type_ != content_type) { - uma_container_->UpdateHistograms(); uma_container_.reset(new UmaSamplesContainer(GetUmaPrefix(content_type))); content_type_ = content_type; } -- cgit v1.2.3