Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: webrtc/system_wrappers/source/rtp_to_ntp_estimator.cc

Issue 3006003002: RtpToNtpEstimator:: Add a DCHECK to avoid div-by-0 (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/system_wrappers/source/rtp_to_ntp_estimator.cc
diff --git a/webrtc/system_wrappers/source/rtp_to_ntp_estimator.cc b/webrtc/system_wrappers/source/rtp_to_ntp_estimator.cc
index d65bf98207a73918c21f46e5f9c7a37ae1550835..422759939a2a00c7ef396ad8ac34f56e2d340532 100644
--- a/webrtc/system_wrappers/source/rtp_to_ntp_estimator.cc
+++ b/webrtc/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 @@ bool RtpToNtpEstimator::Estimate(int64_t rtp_timestamp,
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);
kwiberg-webrtc 2017/09/01 12:53:06 Is it OK if the value is very, very close to zero?
double rtp_ms =
(static_cast<double>(rtp_timestamp_unwrapped) - params_.offset_ms) /
params_.frequency_khz +
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698