RtpToNtpEstimator:: Add a DCHECK to avoid div-by-0
The division that follows the added DCHECK should not be div-by-0,
since when params_.calculated is true, params_.frequency_khz would
have been updated (with something non-zero).
BUG=none
Review-Url: https://codereview.webrtc.org/3006003002
Cr-Original-Commit-Position: refs/heads/master@{#19671}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: d56ef8085718e15c497b0d9c60baa1a4640420fa
diff --git a/system_wrappers/source/rtp_to_ntp_estimator.cc b/system_wrappers/source/rtp_to_ntp_estimator.cc
index d65bf98..4227599 100644
--- a/system_wrappers/source/rtp_to_ntp_estimator.cc
+++ b/system_wrappers/source/rtp_to_ntp_estimator.cc
@@ -10,6 +10,7 @@
#include "webrtc/system_wrappers/include/rtp_to_ntp_estimator.h"
+#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/logging.h"
#include "webrtc/system_wrappers/include/clock.h"
@@ -162,6 +163,9 @@
return false;
}
+ // params_.calculated should not be true unless params_.frequency_khz has been
+ // set to something non-zero.
+ RTC_DCHECK_NE(params_.frequency_khz, 0.0);
double rtp_ms =
(static_cast<double>(rtp_timestamp_unwrapped) - params_.offset_ms) /
params_.frequency_khz +