| Index: webrtc/modules/rtp_rtcp/source/rtcp_packet.h
|
| diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet.h
|
| index 33064aac1581019dcf965f067e86d66f8ddf7405..0a651510f949a49a07ebff0a86f1a2a6a299eb82 100644
|
| --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet.h
|
| +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet.h
|
| @@ -14,17 +14,42 @@
|
|
|
| #include <vector>
|
|
|
| +#include "webrtc/base/buffer.h"
|
| #include "webrtc/base/scoped_ptr.h"
|
| #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
|
| #include "webrtc/typedefs.h"
|
|
|
| namespace webrtc {
|
| namespace rtcp {
|
| +// TODO(danilchap): Remove RawPacket when all tests will be updated
|
| +// to use rtc::Buffer directly
|
| +class RawPacket : rtc::Buffer {
|
| + public:
|
| + RawPacket() {}
|
| + RawPacket(rtc::Buffer&& buffer) : rtc::Buffer(buffer) {} // NOLINT
|
| + const uint8_t* Buffer() const { return data(); }
|
| + uint8_t* MutableBuffer() { return data(); }
|
| + size_t Length() const { return size(); }
|
| +};
|
| +} // namespace rtcp
|
| +} // namespace webrtc
|
|
|
| -static const int kCommonFbFmtLength = 12;
|
| -
|
| -class RawPacket;
|
| +// TODO(danilchap): Remove this horrible template specialization when all tests
|
| +// will be updated to use rtc::Buffer directly.
|
| +// Template is specialized to make current code compile and work like before,
|
| +// it is not designed to match what proper scoped_ptr do.
|
| +template<>
|
| +class ::rtc::scoped_ptr<webrtc::rtcp::RawPacket> : webrtc::rtcp::RawPacket {
|
| + public:
|
| + scoped_ptr() {}
|
| + scoped_ptr(rtc::Buffer&& buffer) : RawPacket(std::move(buffer)) {} // NOLINT
|
| + webrtc::rtcp::RawPacket* get() { return this; }
|
| + webrtc::rtcp::RawPacket& operator*() { return *this; }
|
| + webrtc::rtcp::RawPacket* operator->() { return this; }
|
| +};
|
|
|
| +namespace webrtc {
|
| +namespace rtcp {
|
| // Class for building RTCP packets.
|
| //
|
| // Example:
|
| @@ -44,11 +69,11 @@ class RawPacket;
|
| // uint8_t packet[kPacketSize]; // with sequence number 56.
|
| // fir.Build(packet, &length, kPacketSize);
|
| //
|
| -// RawPacket packet = fir.Build(); // Returns a RawPacket holding
|
| +// rtc::Buffer packet = fir.Build(); // Returns a RawPacket holding
|
| // // the built rtcp packet.
|
| //
|
| // rr.Append(&fir) // Builds a compound RTCP packet with
|
| -// RawPacket packet = rr.Build(); // a receiver report, report block
|
| +// rtc::Buffer packet = rr.Build(); // a receiver report, report block
|
| // // and fir message.
|
|
|
| class RtcpPacket {
|
| @@ -71,7 +96,7 @@ class RtcpPacket {
|
|
|
| // Convenience method mostly used for test. Max length of IP_PACKET_SIZE is
|
| // used, will cause assertion error if fragmentation occurs.
|
| - rtc::scoped_ptr<RawPacket> Build() const;
|
| + rtc::Buffer Build() const;
|
|
|
| // Returns true if all calls to Create succeeded. A buffer of size
|
| // IP_PACKET_SIZE will be allocated and reused between calls to callback.
|
| @@ -115,33 +140,6 @@ class RtcpPacket {
|
| size_t max_length,
|
| PacketReadyCallback* callback) const;
|
| };
|
| -
|
| -// Class holding a RTCP packet.
|
| -//
|
| -// Takes a built rtcp packet.
|
| -// RawPacket raw_packet(buffer, length);
|
| -//
|
| -// To access the raw packet:
|
| -// raw_packet.Buffer(); - pointer to the raw packet
|
| -// raw_packet.BufferLength(); - the length of the raw packet
|
| -
|
| -class RawPacket {
|
| - public:
|
| - explicit RawPacket(size_t buffer_length);
|
| - RawPacket(const uint8_t* packet, size_t packet_length);
|
| -
|
| - const uint8_t* Buffer() const;
|
| - uint8_t* MutableBuffer();
|
| - size_t BufferLength() const;
|
| - size_t Length() const;
|
| - void SetLength(size_t length);
|
| -
|
| - private:
|
| - const size_t buffer_length_;
|
| - size_t length_;
|
| - rtc::scoped_ptr<uint8_t[]> buffer_;
|
| -};
|
| -
|
| } // namespace rtcp
|
| } // namespace webrtc
|
| #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_H_
|
|
|