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

RTCP XR: cosmetic

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