From 4eccdaa31415375f18e927420119ab197737be69 Mon Sep 17 00:00:00 2001 From: "henrik.lundin" Date: Wed, 14 Jun 2017 07:02:17 -0700 Subject: [PATCH] Fix a numerical issue in NetEq delay plotting Imprecisions in floating point representation caused noise in the graphs. The integer division is in fact exact. BUG= webrtc:7467 Review-Url: https://codereview.webrtc.org/2933053002 Cr-Commit-Position: refs/heads/master@{#18592} --- .../audio_coding/neteq/tools/neteq_delay_analyzer.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_delay_analyzer.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_delay_analyzer.cc index a75da49b22..aedf067278 100644 --- a/webrtc/modules/audio_coding/neteq/tools/neteq_delay_analyzer.cc +++ b/webrtc/modules/audio_coding/neteq/tools/neteq_delay_analyzer.cc @@ -14,6 +14,8 @@ #include #include +#include + namespace webrtc { namespace test { namespace { @@ -115,8 +117,9 @@ void NetEqDelayAnalyzer::CreateGraphs( // This loop traverses data_ and populates rtp_timestamps_ms as well as // calculates the base offset. for (auto& d : data_) { - rtp_timestamps_ms.push_back(unwrapper.Unwrap(d.first) / - (last_sample_rate_hz_ / 1000.f)); + rtp_timestamps_ms.push_back( + unwrapper.Unwrap(d.first) / + rtc::CheckedDivExact(last_sample_rate_hz_, 1000)); offset = std::min(offset, d.second.arrival_time_ms - rtp_timestamps_ms.back()); }