Fix RtpFileSource when reading full RTP packets

Bug: webrtc:437816262
Change-Id: If69e649a985600d91ca8cece1ca83d82dfeda6c3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/404040
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45321}
diff --git a/modules/audio_coding/neteq/tools/rtp_file_source.cc b/modules/audio_coding/neteq/tools/rtp_file_source.cc
index cb975d0..a6485da 100644
--- a/modules/audio_coding/neteq/tools/rtp_file_source.cc
+++ b/modules/audio_coding/neteq/tools/rtp_file_source.cc
@@ -75,7 +75,9 @@
       continue;
     }
     rtp_packet->set_arrival_time(Timestamp::Millis(temp_packet.time_ms));
-    if (temp_packet.original_length > rtp_packet->headers_size()) {
+
+    // Simulate payload if only the RTP header was written in the file.
+    if (temp_packet.original_length > rtp_packet->size()) {
       size_t payload_size =
           temp_packet.original_length - rtp_packet->headers_size();
       if (rtp_packet->has_padding()) {