Fix discrepancy when std_dev = 0.

Bug: webrtc:431021030
Change-Id: Ib19ce5a1d7955e93ae9eac2d7afe772b5263831f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/400020
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Fanny Linderborg <linderborg@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45136}
diff --git a/video/corruption_detection/halton_frame_sampler.cc b/video/corruption_detection/halton_frame_sampler.cc
index afedb42..4efadcf 100644
--- a/video/corruption_detection/halton_frame_sampler.cc
+++ b/video/corruption_detection/halton_frame_sampler.cc
@@ -111,8 +111,14 @@
   RTC_CHECK_LT(row, frame_sampler.height(channel));
   RTC_CHECK_GE(column, 0);
   RTC_CHECK_LT(column, frame_sampler.width(channel));
-  RTC_CHECK_GT(std_dev, 0.0)
-      << "Standard deviation = 0 yields improper Gaussian weights.";
+  RTC_CHECK_GE(std_dev, 0.0);
+
+  // `std_dev` being zero should ideally correspond to a very low QP value. In
+  // this case even a noisy pixel should be able to be encoded and transmitted
+  // correctly. Hence, the pixel value can be used as is.
+  if (std_dev == 0.0) {
+    return frame_sampler.GetSampleValue(channel, column, row);
+  }
 
   int max_distance =
       std::ceil(std::sqrt(-2.0 * std::log(kCutoff) * std::pow(std_dev, 2.0))) -