![]() 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_RECEIVER_REFERENCE_TIME_HPP #define MS_RTC_RTCP_XR_RECEIVER_REFERENCE_TIME_HPP #include "common.hpp" #include "RTC/RTCP/XR.hpp" /* https://tools.ietf.org/html/rfc3611 * Receiver Reference Time 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=4 | reserved | block length = 2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NTP timestamp, most significant word | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NTP timestamp, least significant word | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ namespace RTC { namespace RTCP { class ReceiverReferenceTime : public ExtendedReportBlock { public: struct Body { uint32_t ntpSec; uint32_t ntpFrac; }; public: static ReceiverReferenceTime* Parse(const uint8_t* data, size_t len); public: // Locally generated Report. Holds the data internally. ReceiverReferenceTime() : ExtendedReportBlock(RTCP::ExtendedReportBlock::Type::RRT) { this->body = reinterpret_cast<Body*>(this->raw); } // Parsed Report. Points to an external data. explicit ReceiverReferenceTime(CommonHeader* header) : ExtendedReportBlock(ExtendedReportBlock::Type::RRT) { this->header = header; this->body = reinterpret_cast<Body*>((header) + 1); } public: uint32_t GetNtpSec() const { return uint32_t{ ntohl(this->body->ntpSec) }; } void SetNtpSec(uint32_t ntpSec) { this->body->ntpSec = uint32_t{ htonl(ntpSec) }; } uint32_t GetNtpFrac() const { return uint32_t{ ntohl(this->body->ntpFrac) }; } void SetNtpFrac(uint32_t ntpFrac) { this->body->ntpFrac = uint32_t{ htonl(ntpFrac) }; } /* 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{ 4 }; // Common header. size += sizeof(Body); return size; } private: Body* body{ nullptr }; uint8_t raw[sizeof(Body)] = { 0 }; }; } // namespace RTCP } // namespace RTC #endif