![]() 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/src/RTC/ |
Upload File : |
#define MS_CLASS "RTC::RtpProbationPacketPacer" // #define MS_LOG_DEV_LEVEL 3 #include "RTC/RtpProbationPacketPacer.hpp" #include "Logger.hpp" namespace RTC { static uint8_t PacingIntervalMs{ 10u }; RtpProbationPacketPacer::RtpProbationPacketPacer(RTC::RtpProbationPacketPacer::Listener* listener) : listener(listener) { MS_TRACE(); this->probationGenerator = new RTC::RtpProbationGenerator(); this->timer = new Timer(this); } RtpProbationPacketPacer::~RtpProbationPacketPacer() { MS_TRACE(); delete this->probationGenerator; this->probationGenerator = nullptr; delete this->timer; this->timer = nullptr; } void RtpProbationPacketPacer::SendPadding(size_t bytes, const webrtc::PacedPacketInfo& pacingInfo) { MS_TRACE(); this->paddingInfos.emplace_back(bytes, pacingInfo); if (this->paddingInfos.size() == 1) { this->timer->Start(PacingIntervalMs); } } void RtpProbationPacketPacer::OnTimer(Timer* timer) { MS_TRACE(); if (timer == this->timer) { if (this->paddingInfos.empty()) { return; } auto& pair = this->paddingInfos.front(); auto* packet = this->probationGenerator->GetNextPacket(pair.first); this->paddingInfos.pop_front(); this->listener->OnRtpProbationPacketPacerSendPacket(packet, pair.second); if (!this->paddingInfos.empty()) { this->timer->Start(PacingIntervalMs); } } } } // namespace RTC