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}
diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc
index 4e39514..0fc125c 100644
--- a/webrtc/video/video_quality_test.cc
+++ b/webrtc/video/video_quality_test.cc
@@ -387,10 +387,16 @@
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;
}