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 d6bef2b1d6..b11fb970df 100644 --- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc +++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc @@ -63,8 +63,10 @@ double RateCounter::GetEventsPerSecond() const { (event_last_time_ - event_first_time_).us() * kMicrosPerSecond; } -DefaultVideoQualityAnalyzer::DefaultVideoQualityAnalyzer() - : clock_(Clock::GetRealTimeClock()) {} +DefaultVideoQualityAnalyzer::DefaultVideoQualityAnalyzer( + bool heavy_metrics_computation_enabled) + : heavy_metrics_computation_enabled_(heavy_metrics_computation_enabled), + clock_(Clock::GetRealTimeClock()) {} DefaultVideoQualityAnalyzer::~DefaultVideoQualityAnalyzer() { Stop(); } @@ -497,7 +499,8 @@ void DefaultVideoQualityAnalyzer::ProcessComparison( // Perform expensive psnr and ssim calculations while not holding lock. double psnr = -1.0; double ssim = -1.0; - if (comparison.captured && !comparison.dropped) { + if (heavy_metrics_computation_enabled_ && comparison.captured && + !comparison.dropped) { psnr = I420PSNR(&*comparison.captured, &*comparison.rendered); ssim = I420SSIM(&*comparison.captured, &*comparison.rendered); } diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h index 8d7f8c0d8c..30efdf61e6 100644 --- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h +++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h @@ -122,7 +122,8 @@ struct VideoBweStats { class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface { public: - DefaultVideoQualityAnalyzer(); + explicit DefaultVideoQualityAnalyzer( + bool heavy_metrics_computation_enabled = true); ~DefaultVideoQualityAnalyzer() override; void Start(std::string test_case_name, int max_threads_count) override; @@ -248,6 +249,7 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface { std::string GetTestCaseName(const std::string& stream_label) const; Timestamp Now(); + const bool heavy_metrics_computation_enabled_; webrtc::Clock* const clock_; std::atomic next_frame_id_{0};