diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer_test.cc b/test/pc/e2e/analyzer/video/default_video_quality_analyzer_test.cc index 5fdd0510c6..8b7ce86245 100644 --- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer_test.cc +++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer_test.cc @@ -8,6 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include #include #include #include @@ -98,6 +99,15 @@ std::string ToString(const std::vector& values) { return out.str(); } +void FakeCPULoad() { + std::vector temp(100000); + for (size_t i = 0; i < temp.size(); ++i) { + temp[i] = rand(); + } + std::sort(temp.begin(), temp.end()); + ASSERT_TRUE(std::is_sorted(temp.begin(), temp.end())); +} + TEST(DefaultVideoQualityAnalyzerTest, MemoryOverloadedAndThenAllFramesReceived) { std::unique_ptr frame_generator = @@ -712,6 +722,10 @@ TEST(DefaultVideoQualityAnalyzerTest, CpuUsage) { VideoQualityAnalyzerInterface::EncoderStats()); } + // Windows CPU clock has low accuracy. We need to fake some additional load to + // be sure that the clock ticks (https://crbug.com/webrtc/12249). + FakeCPULoad(); + for (size_t i = 1; i < frames_order.size(); i += 2) { uint16_t frame_id = frames_order.at(i); VideoFrame received_frame = DeepCopy(captured_frames.at(frame_id)); @@ -729,15 +743,7 @@ TEST(DefaultVideoQualityAnalyzerTest, CpuUsage) { analyzer.Stop(); double cpu_usage = analyzer.GetCpuUsagePercent(); - // On windows bots GetProcessCpuTimeNanos doesn't work properly (returns the - // same number over the whole run). Adhoc solution to prevent them from - // failing. - // TODO(12249): remove it after issue is fixed. -#if defined(WEBRTC_WIN) - ASSERT_GE(cpu_usage, 0); -#else ASSERT_GT(cpu_usage, 0); -#endif SleepMs(100); analyzer.Stop();