Fix RtpFrameReferenceFinderFuzzer to not generate invalid input

Make sure that the packets in the packet buffer belonging to the
first and last sequence numbers are marked as first and last,
respectively.

Bug: chromium:989856
Change-Id: I57bdd7d62d585be2d2083a6b5ce67fce89ab4389
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147875
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28769}
diff --git a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
index 417c7a8..a980d3d 100644
--- a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
+++ b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
@@ -123,9 +123,16 @@
   video_coding::RtpFrameReferenceFinder reference_finder(&cb);
 
   while (reader.MoreToRead()) {
+    // Make sure that these packets fulfill the contract of RtpFrameObject.
+    uint16_t first_seq_num = reader.GetNum<uint16_t>();
+    uint16_t last_seq_num = reader.GetNum<uint16_t>();
+    VCMPacket* first_packet = pb->GetPacket(first_seq_num);
+    VCMPacket* last_packet = pb->GetPacket(last_seq_num);
+    first_packet->video_header.is_first_packet_in_frame = true;
+    last_packet->video_header.is_last_packet_in_frame = true;
+
     auto frame = absl::make_unique<video_coding::RtpFrameObject>(
-        pb, reader.GetNum<uint16_t>(), reader.GetNum<uint16_t>(), 0, 0, 0, 0,
-        RtpPacketInfos());
+        pb, first_seq_num, last_seq_num, 0, 0, 0, 0, RtpPacketInfos());
     reference_finder.ManageFrame(std::move(frame));
   }
 }