PacketBuffer no longer copy the bitstream data of incoming packets.

This change the interface of the PacketBuffer since the bitstream data of the packet has to be persistent when inserted into the PacketBuffer.

BUG=webrtc:5514
R=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/2476283002 .

Cr-Commit-Position: refs/heads/master@{#14949}
This commit is contained in:
philipel
2016-11-07 15:42:24 +01:00
parent a75d12d09d
commit 41b8ca0420
2 changed files with 43 additions and 37 deletions

View File

@ -100,16 +100,6 @@ bool PacketBuffer::InsertPacket(const VCMPacket& packet) {
sequence_buffer_[index].used = true;
data_buffer_[index] = packet;
// Since the data pointed to by |packet.dataPtr| is non-persistent the
// data has to be copied to its own buffer.
// TODO(philipel): Take ownership instead of copying payload when
// bitstream-fixing has been implemented.
if (packet.sizeBytes) {
uint8_t* payload = new uint8_t[packet.sizeBytes];
memcpy(payload, packet.dataPtr, packet.sizeBytes);
data_buffer_[index].dataPtr = payload;
}
FindFrames(seq_num);
return true;
}