Use real video duration instead of test duration.
Use real video duration instead of test duration to calculate harmonic
frame rate in DefaultVideoQualityAnalyzer.
Bug: webrtc:11445
Change-Id: Ia5f96b2f87178419ec6ebe2ff5dbcb5a0c03c824
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171104
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30854}
diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
index a1c5d0a..7f61a37 100644
--- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
+++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
@@ -592,20 +592,30 @@
using ::webrtc::test::ImproveDirection;
double sum_squared_interframe_delays_secs = 0;
- for (const double interframe_delay_ms :
- stats.time_between_rendered_frames_ms.GetSamples()) {
+ Timestamp video_start_time = Timestamp::PlusInfinity();
+ Timestamp video_end_time = Timestamp::MinusInfinity();
+ for (const SamplesStatsCounter::StatsSample& sample :
+ stats.time_between_rendered_frames_ms.GetTimedSamples()) {
+ double interframe_delay_ms = sample.value;
const double interframe_delays_secs = interframe_delay_ms / 1000.0;
// Sum of squared inter frame intervals is used to calculate the harmonic
// frame rate metric. The metric aims to reflect overall experience related
// to smoothness of video playback and includes both freezes and pauses.
sum_squared_interframe_delays_secs +=
interframe_delays_secs * interframe_delays_secs;
+ if (sample.time < video_start_time) {
+ video_start_time = sample.time;
+ }
+ if (sample.time > video_end_time) {
+ video_end_time = sample.time;
+ }
}
double harmonic_framerate_fps = 0;
- if (sum_squared_interframe_delays_secs > 0.0) {
- TimeDelta video_duration = Now() - start_time_;
- harmonic_framerate_fps =
- video_duration.seconds() / sum_squared_interframe_delays_secs;
+ TimeDelta video_duration = video_end_time - video_start_time;
+ if (sum_squared_interframe_delays_secs > 0.0 && video_duration.IsFinite()) {
+ harmonic_framerate_fps = static_cast<double>(video_duration.us()) /
+ static_cast<double>(kMicrosPerSecond) /
+ sum_squared_interframe_delays_secs;
}
ReportResult("psnr", test_case_name, stats.psnr, "dB",