Fix RateCounter to don't fail if there are too small amount of events

Bug: webrtc:10138
Change-Id: Iac26e4948b92810245c16b8c46b4b3e70850505e
Reviewed-on: https://webrtc-review.googlesource.com/c/123193
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26712}
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 c3bf685..e4fcd20 100644
--- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
+++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
@@ -25,6 +25,7 @@
 
 constexpr int kMaxActiveComparisons = 10;
 constexpr int kFreezeThresholdMs = 150;
+constexpr int kMicrosPerSecond = 1000000;
 
 }  // namespace
 
@@ -38,8 +39,11 @@
 
 double RateCounter::GetEventsPerSecond() const {
   RTC_DCHECK(!IsEmpty());
+  // Divide on us and multiply on kMicrosPerSecond to correctly process cases
+  // where there were too small amount of events, so difference is less then 1
+  // sec. We can use us here, because Timestamp has us resolution.
   return static_cast<double>(event_count_) /
-         (event_last_time_ - event_first_time_).seconds();
+         (event_last_time_ - event_first_time_).us() * kMicrosPerSecond;
 }
 
 DefaultVideoQualityAnalyzer::DefaultVideoQualityAnalyzer(std::string test_label)