From b1eaa8df0d5e3589771cd4c4a9d6d7707b116a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= Date: Tue, 23 Feb 2016 17:30:49 +0100 Subject: [PATCH] Only average positive quality stats. Removes addition of at least one zero sample in webrtc_perf_tests that can skew stats differently depending on how often these stats are updated. Unclear if this skewing is different between now and before. BUG=chromium:585071, chromium:586216 R=sprang@google.com, sprang@webrtc.org Review URL: https://codereview.webrtc.org/1727583003 . Cr-Commit-Position: refs/heads/master@{#11720} --- webrtc/video/video_quality_test.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc index 4e39514301..0fc125c759 100644 --- a/webrtc/video/video_quality_test.cc +++ b/webrtc/video/video_quality_test.cc @@ -387,10 +387,16 @@ class VideoAnalyzer : public PacketReceiver, VideoSendStream::Stats stats = send_stream_->GetStats(); rtc::CritScope crit(&comparison_lock_); - encode_frame_rate_.AddSample(stats.encode_frame_rate); - encode_time_ms.AddSample(stats.avg_encode_time_ms); - encode_usage_percent.AddSample(stats.encode_usage_percent); - media_bitrate_bps.AddSample(stats.media_bitrate_bps); + // It's not certain that we yet have estimates for any of these stats. Check + // that they are positive before mixing them in. + if (stats.encode_frame_rate > 0) + encode_frame_rate_.AddSample(stats.encode_frame_rate); + if (stats.avg_encode_time_ms > 0) + encode_time_ms.AddSample(stats.avg_encode_time_ms); + if (stats.encode_usage_percent > 0) + encode_usage_percent.AddSample(stats.encode_usage_percent); + if (stats.media_bitrate_bps > 0) + media_bitrate_bps.AddSample(stats.media_bitrate_bps); return true; }