![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/local/lib/node_modules/mediasoup/worker/include/RTC/RTCP/ |
Upload File : |
#ifndef MS_RTC_RTCP_XR_DELAY_SINCE_LAST_RR_HPP #define MS_RTC_RTCP_XR_DELAY_SINCE_LAST_RR_HPP #include "common.hpp" #include "RTC/RTCP/XR.hpp" /* https://tools.ietf.org/html/rfc3611 * Delay Since Last Receiver Report (DLRR) Report Block 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BT=5 | reserved | block length | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | SSRC_1 (SSRC of first receiver) | sub- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block | last RR (LRR) | 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | delay since last RR (DLRR) | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | SSRC_2 (SSRC of second receiver) | sub- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block : ... : 2 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ */ namespace RTC { namespace RTCP { 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 { uint32_t ssrc; uint32_t lrr; uint32_t dlrr; }; public: // Locally generated Report. Holds the data internally. SsrcInfo() { this->body = reinterpret_cast<Body*>(this->raw); } // Parsed Report. Points to an external data. explicit SsrcInfo(Body* body) : body(body) { } void Dump() const; size_t Serialize(uint8_t* buffer); size_t GetSize() const { return sizeof(Body); } uint32_t GetSsrc() const { return uint32_t{ ntohl(this->body->ssrc) }; } void SetSsrc(uint32_t ssrc) { this->body->ssrc = uint32_t{ htonl(ssrc) }; } uint32_t GetLastReceiverReport() const { return uint32_t{ ntohl(this->body->lrr) }; } void SetLastReceiverReport(uint32_t lrr) { this->body->lrr = uint32_t{ htonl(lrr) }; } uint32_t GetDelaySinceLastReceiverReport() const { return uint32_t{ ntohl(this->body->dlrr) }; } void SetDelaySinceLastReceiverReport(uint32_t dlrr) { this->body->dlrr = uint32_t{ htonl(dlrr) }; } private: Body* body{ nullptr }; uint8_t raw[sizeof(Body)] = { 0 }; }; public: using Iterator = std::vector<SsrcInfo*>::iterator; public: DelaySinceLastRr() : ExtendedReportBlock(ExtendedReportBlock::Type::DLRR) { } explicit DelaySinceLastRr(CommonHeader* header) : ExtendedReportBlock(ExtendedReportBlock::Type::DLRR) { this->header = header; } ~DelaySinceLastRr() { for (auto* ssrcInfo : this->ssrcInfos) { delete ssrcInfo; } } public: void AddSsrcInfo(SsrcInfo* ssrcInfo) { this->ssrcInfos.push_back(ssrcInfo); } Iterator Begin() { return this->ssrcInfos.begin(); } Iterator End() { return this->ssrcInfos.end(); } /* Pure virtual methods inherited from ExtendedReportBlock. */ public: virtual void Dump() const override; virtual size_t Serialize(uint8_t* buffer) override; virtual size_t GetSize() const override { size_t size{ 4u }; // Common header. for (auto* ssrcInfo : this->ssrcInfos) { size += ssrcInfo->GetSize(); } return size; } private: std::vector<SsrcInfo*> ssrcInfos; }; } // namespace RTCP } // namespace RTC #endif