Prevent fuzzing replayer being stuck forever on malformed packet times.

It is possible for the fuzzer to just never deliver packets if the packet delay
is set long enough in the RtpReplayer. This is simply fixed by setting an upper
bound. This change is in the test code setup.

Bug: webrtc:10493,chromium:943420
Change-Id: I54f56e1aa7700f1151e0b58a5a53bc789d032c18
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130365
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27369}
This commit is contained in:
Benjamin Wright 2019-03-29 15:56:06 -07:00 committed by Commit Bot
parent 1a08037fe7
commit 3295c01df2

View File

@ -10,6 +10,7 @@
#include "test/fuzzers/utils/rtp_replayer.h"
#include <algorithm>
#include <string>
#include <utility>
@ -140,7 +141,8 @@ void RtpReplayer::ReplayPackets(Call* call, test::RtpFileReader* rtp_reader) {
int64_t deliver_in_ms = replay_start_ms + packet.time_ms - now_ms;
if (deliver_in_ms > 0) {
SleepMs(deliver_in_ms);
// Set an upper limit on sleep to prevent timing out.
SleepMs(std::min(deliver_in_ms, static_cast<int64_t>(100)));
}
++num_packets;