Split ByteBuffer into writer/reader objects.

This allows the reader to reference data, thus avoiding unnecessary
allocations and memory copies.

BUG=webrtc:5155,webrtc:5670

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

Cr-Commit-Position: refs/heads/master@{#12160}
This commit is contained in:
jbauch
2016-03-30 06:43:37 -07:00
committed by Commit bot
parent 0d05da7ee6
commit f1f87203d7
33 changed files with 488 additions and 454 deletions

View File

@ -24,7 +24,8 @@
#include "webrtc/media/base/videocommon.h"
namespace rtc {
class ByteBuffer;
class ByteBufferReader;
class ByteBufferWriter;
class StreamInterface;
}
@ -45,8 +46,8 @@ class RtpDumpWriter;
class VideoFrame;
struct RawRtpPacket {
void WriteToByteBuffer(uint32_t in_ssrc, rtc::ByteBuffer* buf) const;
bool ReadFromByteBuffer(rtc::ByteBuffer* buf);
void WriteToByteBuffer(uint32_t in_ssrc, rtc::ByteBufferWriter* buf) const;
bool ReadFromByteBuffer(rtc::ByteBufferReader* buf);
// Check if this packet is the same as the specified packet except the
// sequence number and timestamp, which should be the same as the specified
// parameters.
@ -65,8 +66,8 @@ struct RawRtpPacket {
};
struct RawRtcpPacket {
void WriteToByteBuffer(rtc::ByteBuffer* buf) const;
bool ReadFromByteBuffer(rtc::ByteBuffer* buf);
void WriteToByteBuffer(rtc::ByteBufferWriter* buf) const;
bool ReadFromByteBuffer(rtc::ByteBufferReader* buf);
bool EqualsTo(const RawRtcpPacket& packet) const;
uint8_t ver_to_count;