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}
This commit is contained in:
henrik.lundin 2017-06-14 07:02:17 -07:00 committed by Commit Bot
parent 7a721e84f8
commit 4eccdaa314

View File

@ -14,6 +14,8 @@
#include <limits>
#include <utility>
#include <webrtc/base/checks.h>
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());
}