Generate packets of original packet length in video_replay.

An RTP dump may or may not include the payload of the recorded RTP packets. When the payload is not present packets should still be created with their original packet length.

Bug: webrtc:14801
Change-Id: Ice74cb5f7d370aaefac5f370445ffd3f2fc5924c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/289920
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38979}
This commit is contained in:
philipel 2022-12-30 11:45:22 +01:00 committed by WebRTC LUCI CQ
parent 0dbce83d1a
commit 0c2981364f

View File

@ -570,7 +570,17 @@ class RtpReplayer final {
if (!rtp_reader_->NextPacket(&packet)) {
break;
}
rtc::CopyOnWriteBuffer packet_buffer(packet.data, packet.length);
rtc::CopyOnWriteBuffer packet_buffer(
packet.original_length > 0 ? packet.original_length : packet.length);
memcpy(packet_buffer.MutableData(), packet.data, packet.length);
if (packet.length < packet.original_length) {
// Only the RTP header was recorded in the RTP dump, payload is not
// known and and padding length is not known, zero the payload and
// clear the padding bit.
memset(packet_buffer.MutableData() + packet.length, 0,
packet.original_length - packet.length);
packet_buffer.MutableData()[0] &= ~0x20;
}
RtpPacket header;
header.Parse(packet_buffer);
if (header.Timestamp() < start_timestamp ||