提交 ad4bc122 authored 作者: José Luis Millán's avatar José Luis Millán

RTCP XR: cosmetic

上级 15934e3d
......@@ -52,12 +52,11 @@ namespace RTC
ExtendedReportBlock(Type type);
virtual ~ExtendedReportBlock() = default;
ExtendedReportBlock::Type GetType() const;
public:
virtual void Dump() const = 0;
virtual size_t Serialize(uint8_t* buffer) = 0;
virtual size_t GetSize() const = 0;
ExtendedReportBlock::Type GetType() const;
protected:
Type type;
......@@ -97,7 +96,7 @@ namespace RTC
std::vector<ExtendedReportBlock*> reports;
};
// Inline ExtendedReportBlock methods.
/* Inline ExtendedReportBlock instance methods. */
inline ExtendedReportBlock::ExtendedReportBlock(Type type) : type(type)
{
......@@ -126,7 +125,7 @@ namespace RTC
this->ssrc = uint32_t{ htonl(ssrc) };
}
// Inline ExtendedReportPacket methods.
/* Inline ExtendedReportPacket instance methods. */
inline ExtendedReportPacket::ExtendedReportPacket() : Packet(Type::XR)
{
......
......@@ -29,9 +29,15 @@ namespace RTC
{
class DelaySinceLastRr : public ExtendedReportBlock
{
public:
static DelaySinceLastRr* Parse(const uint8_t* data, size_t len);
public:
class SsrcInfo
{
public:
static SsrcInfo* Parse(const uint8_t* data, size_t len);
public:
struct Body
{
......@@ -40,9 +46,6 @@ namespace RTC
uint32_t dlrr;
};
public:
static SsrcInfo* Parse(const uint8_t* data, size_t len);
public:
// Parsed Report. Points to an external data.
explicit SsrcInfo(Body* body);
......@@ -68,19 +71,15 @@ namespace RTC
public:
using Iterator = std::vector<SsrcInfo*>::iterator;
public:
static DelaySinceLastRr* Parse(const uint8_t* data, size_t len);
public:
explicit DelaySinceLastRr(CommonHeader* header);
DelaySinceLastRr();
~DelaySinceLastRr();
Iterator Begin();
Iterator End();
public:
void AddSsrcInfo(SsrcInfo* ssrcInfo);
Iterator Begin();
Iterator End();
/* Pure virtual methods inherited from ExtendedReportBlock. */
public:
......
......@@ -36,10 +36,10 @@ namespace RTC
public:
// Parsed Report. Points to an external data.
explicit ReceiverReferenceTime(CommonHeader* header);
// Locally generated Report. Holds the data internally.
ReceiverReferenceTime();
public:
uint32_t GetNtpSec() const;
void SetNtpSec(uint32_t ntpSec);
uint32_t GetNtpFrac() const;
......@@ -56,7 +56,7 @@ namespace RTC
uint8_t raw[sizeof(Body)] = { 0 };
};
/* Inline instance methods. */
/* Inline ReceiverReferenceTime instance methods. */
inline ReceiverReferenceTime::ReceiverReferenceTime()
: ExtendedReportBlock(RTCP::ExtendedReportBlock::Type::RRT)
......
......@@ -65,7 +65,6 @@ namespace RTC
std::unique_ptr<DelaySinceLastRr> report(new DelaySinceLastRr(header));
size_t offset{ sizeof(ExtendedReportBlock::CommonHeader) };
uint16_t reportLength = ntohs(header->length) * 4;
while (len > offset && reportLength >= sizeof(DelaySinceLastRr::SsrcInfo::Body))
......@@ -121,18 +120,15 @@ namespace RTC
MS_TRACE();
MS_DUMP("<DelaySinceLastRr>");
MS_DUMP(" block type : %" PRIu8, this->type);
MS_DUMP(" reserved : 0");
MS_DUMP(
" length : %" PRIu16,
static_cast<uint16_t>((sizeof(SsrcInfo::Body) * this->ssrcInfos.size() / 4)));
for (auto* ssrcInfo : this->ssrcInfos)
{
ssrcInfo->Dump();
}
MS_DUMP("</DelaySinceLastRr>");
}
} // namespace RTCP
......
......@@ -35,7 +35,6 @@ namespace RTC
MS_TRACE();
MS_DUMP("<ReceiverReferenceTime>");
MS_DUMP(" block type : %" PRIu8, this->type);
MS_DUMP(" reserved : 0");
MS_DUMP(" length : 2");
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论