In ULP FEC fuzzer test, make sure sequence number is not the same as previous sequence number.
Bug: chromium:859265
Change-Id: I9acb9a177dfed3830ead0ba5a16ee4310f4d2b5b
Reviewed-on: https://webrtc-review.googlesource.com/86547
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23806}
diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn
index c923b54..4811cb5 100644
--- a/test/fuzzers/BUILD.gn
+++ b/test/fuzzers/BUILD.gn
@@ -162,6 +162,7 @@
"ulpfec_generator_fuzzer.cc",
]
deps = [
+ "../../modules:module_api_public",
"../../modules/rtp_rtcp",
"../../modules/rtp_rtcp:fec_test_helper",
"../../modules/rtp_rtcp:rtp_rtcp_format",
diff --git a/test/fuzzers/ulpfec_generator_fuzzer.cc b/test/fuzzers/ulpfec_generator_fuzzer.cc
index 2536b54..ce9d8fd 100644
--- a/test/fuzzers/ulpfec_generator_fuzzer.cc
+++ b/test/fuzzers/ulpfec_generator_fuzzer.cc
@@ -10,6 +10,7 @@
#include <memory>
+#include "modules/include/module_common_types_public.h"
#include "modules/rtp_rtcp/source/byte_io.h"
#include "modules/rtp_rtcp/source/fec_test_helper.h"
#include "modules/rtp_rtcp/source/ulpfec_generator.h"
@@ -49,8 +50,8 @@
// Check the sequence numbers are monotonic. In rare case the packets number
// may loop around and in the same FEC-protected group the packet sequence
// number became out of order.
- if (protect && static_cast<uint16_t>(seq_num - prev_seq_num) <
- kUlpfecMaxMediaPackets) {
+ if (protect && IsNewerSequenceNumber(seq_num, prev_seq_num) &&
+ seq_num < prev_seq_num + kUlpfecMaxMediaPackets) {
generator.AddRtpPacketAndGenerateFec(packet.get(), payload_size,
rtp_header_length);
prev_seq_num = seq_num;