From e6c0964572b1d6ae07157fb55dc05dba7ec34373 Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Fri, 11 May 2018 10:53:02 +0200 Subject: [PATCH] Ensures that arrival is past send time in SimulatedNetwork. Bug: webrtc:8415 Change-Id: I2797c7dfb3e7b9622a12c2d1e35462e0c686fa8e Reviewed-on: https://webrtc-review.googlesource.com/76101 Commit-Queue: Sebastian Jansson Reviewed-by: Niels Moller Cr-Commit-Position: refs/heads/master@{#23228} --- call/fake_network_pipe.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/call/fake_network_pipe.cc b/call/fake_network_pipe.cc index 284a542ce7..00b6f0e74f 100644 --- a/call/fake_network_pipe.cc +++ b/call/fake_network_pipe.cc @@ -308,10 +308,10 @@ std::vector SimulatedNetwork::DequeueDeliverablePackets( bursting_ = false; } - int64_t arrival_time_jitter_us = - random_.Gaussian(config.queue_delay_ms, - config.delay_standard_deviation_ms) * - 1000; + int64_t arrival_time_jitter_us = std::max( + random_.Gaussian(config.queue_delay_ms * 1000, + config.delay_standard_deviation_ms * 1000), + 0.0); // If reordering is not allowed then adjust arrival_time_jitter // to make sure all packets are sent in order.