SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
|
#include <rtcpscheduler.h>
Public Member Functions | |
RTCPScheduler (RTPSources &sources, RTPRandom &rtprand) | |
~RTCPScheduler () | |
void | Reset () |
void | SetParameters (const RTCPSchedulerParams ¶ms) |
RTCPSchedulerParams | GetParameters () const |
void | SetHeaderOverhead (std::size_t numbytes) |
std::size_t | GetHeaderOverhead () const |
void | AnalyseIncoming (RTCPCompoundPacket &rtcpcomppack) |
void | AnalyseOutgoing (RTCPCompoundPacket &rtcpcomppack) |
void | ActiveMemberDecrease () |
void | ScheduleBYEPacket (std::size_t packetsize) |
RTPTime | GetTransmissionDelay () |
bool | IsTime () |
RTPTime | CalculateDeterministicInterval (bool sender=false) |
Private Member Functions | |
void | CalculateNextRTCPTime () |
void | PerformReverseReconsideration () |
RTPTime | CalculateBYETransmissionInterval () |
RTPTime | CalculateTransmissionInterval (bool sender) |
Private Attributes | |
RTPSources & | sources |
RTCPSchedulerParams | schedparams |
std::size_t | headeroverhead |
std::size_t | avgrtcppacksize |
bool | hassentrtcp |
bool | firstcall |
RTPTime | nextrtcptime |
RTPTime | prevrtcptime |
int | pmembers |
bool | byescheduled |
int | byemembers |
int | pbyemembers |
std::size_t | avgbyepacketsize |
bool | sendbyenow |
RTPRandom & | rtprand |
This class determines when RTCP compound packets should be sent.
Definition at line 125 of file rtcpscheduler.h.
qrtplib::RTCPScheduler::RTCPScheduler | ( | RTPSources & | sources, |
RTPRandom & | rtprand | ||
) |
Creates an instance which will use the source table RTPSources to determine when RTCP compound packets should be scheduled. Creates an instance which will use the source table RTPSources to determine when RTCP compound packets should be scheduled. Note that for correct operation the sources
instance should have information about the own SSRC (added by RTPSources::CreateOwnSSRC). You must also supply a random number generator rtprand
which will be used for adding randomness to the RTCP intervals.
Definition at line 87 of file rtcpscheduler.cpp.
References avgbyepacketsize, byemembers, pbyemembers, pmembers, and Reset().
qrtplib::RTCPScheduler::~RTCPScheduler | ( | ) |
Definition at line 100 of file rtcpscheduler.cpp.
void qrtplib::RTCPScheduler::ActiveMemberDecrease | ( | ) |
This function has to be called each time a member times out or sends a BYE packet.
Definition at line 391 of file rtcpscheduler.cpp.
References qrtplib::RTPSources::GetActiveMemberCount(), PerformReverseReconsideration(), pmembers, and sources.
Referenced by qrtplib::RTPSessionSources::OnBYEPacket(), and qrtplib::RTPSessionSources::OnTimeout().
void qrtplib::RTCPScheduler::AnalyseIncoming | ( | RTCPCompoundPacket & | rtcpcomppack | ) |
For each incoming RTCP compound packet, this function has to be called for the scheduler to work correctly.
Definition at line 114 of file rtcpscheduler.cpp.
References avgbyepacketsize, avgrtcppacksize, qrtplib::RTCPPacket::BYE, byemembers, byescheduled, qrtplib::RTCPCompoundPacket::GetCompoundPacketLength(), qrtplib::RTCPCompoundPacket::GetNextPacket(), qrtplib::RTCPPacket::GetPacketType(), qrtplib::RTCPCompoundPacket::GotoFirstPacket(), and headeroverhead.
Referenced by qrtplib::RTPSessionSources::OnRTCPCompoundPacket().
void qrtplib::RTCPScheduler::AnalyseOutgoing | ( | RTCPCompoundPacket & | rtcpcomppack | ) |
For each outgoing RTCP compound packet, this function has to be called for the scheduler to work correctly.
Definition at line 142 of file rtcpscheduler.cpp.
References avgrtcppacksize, qrtplib::RTCPPacket::BYE, qrtplib::RTCPCompoundPacket::GetCompoundPacketLength(), qrtplib::RTCPCompoundPacket::GetNextPacket(), qrtplib::RTCPPacket::GetPacketType(), qrtplib::RTCPCompoundPacket::GotoFirstPacket(), hassentrtcp, and headeroverhead.
Referenced by qrtplib::RTPSession::ProcessPolledData().
|
private |
Definition at line 397 of file rtcpscheduler.cpp.
References avgbyepacketsize, byemembers, byescheduled, qrtplib::RTPTime::GetDouble(), qrtplib::RTCPSchedulerParams::GetMinimumTransmissionInterval(), qrtplib::RTPRandom::GetRandomDouble(), qrtplib::RTCPSchedulerParams::GetRTCPBandwidth(), qrtplib::RTCPSchedulerParams::GetSenderBandwidthFraction(), qrtplib::RTCPSchedulerParams::GetUseHalfAtStartup(), rtprand, schedparams, and sendbyenow.
Referenced by IsTime(), and ScheduleBYEPacket().
RTPTime qrtplib::RTCPScheduler::CalculateDeterministicInterval | ( | bool | sender = false | ) |
Calculates the deterministic interval at this time. Calculates the deterministic interval at this time. This is used - in combination with a certain multiplier - to time out members, senders etc.
Definition at line 253 of file rtcpscheduler.cpp.
References avgrtcppacksize, qrtplib::RTPSources::GetActiveMemberCount(), qrtplib::RTPTime::GetDouble(), qrtplib::RTCPSchedulerParams::GetMinimumTransmissionInterval(), qrtplib::RTCPSchedulerParams::GetRTCPBandwidth(), qrtplib::RTCPSchedulerParams::GetSenderBandwidthFraction(), qrtplib::RTPSources::GetSenderCount(), qrtplib::RTCPSchedulerParams::GetUseHalfAtStartup(), hassentrtcp, schedparams, and sources.
Referenced by CalculateTransmissionInterval(), and qrtplib::RTPSession::ProcessPolledData().
|
private |
Definition at line 241 of file rtcpscheduler.cpp.
References CalculateTransmissionInterval(), qrtplib::RTPTime::CurrentTime(), qrtplib::RTPSources::GetOwnSourceInfo(), qrtplib::RTPSourceData::IsSender(), nextrtcptime, and sources.
Referenced by GetTransmissionDelay(), and IsTime().
|
private |
Definition at line 303 of file rtcpscheduler.cpp.
References CalculateDeterministicInterval(), qrtplib::RTPTime::GetDouble(), qrtplib::RTPRandom::GetRandomDouble(), and rtprand.
Referenced by CalculateNextRTCPTime(), and IsTime().
|
inline |
|
inline |
Returns the currently used scheduler parameters.
Definition at line 148 of file rtcpscheduler.h.
Referenced by qrtplib::RTPSession::SetSessionBandwidth().
RTPTime qrtplib::RTCPScheduler::GetTransmissionDelay | ( | ) |
Returns the delay after which an RTCP compound will possibly have to be sent. Returns the delay after which an RTCP compound will possibly have to be sent. The IsTime member function should be called afterwards to make sure that it actually is time to send an RTCP compound packet.
Definition at line 163 of file rtcpscheduler.cpp.
References CalculateNextRTCPTime(), qrtplib::RTPTime::CurrentTime(), firstcall, qrtplib::RTPSources::GetActiveMemberCount(), nextrtcptime, pmembers, prevrtcptime, and sources.
Referenced by qrtplib::RTPSession::GetRTCPDelay().
bool qrtplib::RTCPScheduler::IsTime | ( | ) |
This function returns true
if it's time to send an RTCP compound packet and false
otherwise. This function returns true
if it's time to send an RTCP compound packet and false
otherwise. If the function returns true
, it will also have calculated the next time at which a packet should be sent, so if it is called again right away, it will return false
.
Definition at line 184 of file rtcpscheduler.cpp.
References byescheduled, CalculateBYETransmissionInterval(), CalculateNextRTCPTime(), CalculateTransmissionInterval(), qrtplib::RTPTime::CurrentTime(), firstcall, qrtplib::RTPSources::GetActiveMemberCount(), qrtplib::RTPSources::GetOwnSourceInfo(), qrtplib::RTPSourceData::IsSender(), nextrtcptime, pmembers, prevrtcptime, and sources.
Referenced by qrtplib::RTPSession::BYEDestroy(), and qrtplib::RTPSession::ProcessPolledData().
|
private |
Definition at line 321 of file rtcpscheduler.cpp.
References qrtplib::RTPTime::CurrentTime(), firstcall, qrtplib::RTPSources::GetActiveMemberCount(), qrtplib::RTPTime::GetDouble(), nextrtcptime, pmembers, prevrtcptime, and sources.
Referenced by ActiveMemberDecrease().
void qrtplib::RTCPScheduler::Reset | ( | ) |
Resets the scheduler.
Definition at line 104 of file rtcpscheduler.cpp.
References avgrtcppacksize, byescheduled, firstcall, hassentrtcp, headeroverhead, and sendbyenow.
Referenced by qrtplib::RTPSession::BYEDestroy(), qrtplib::RTPSession::Destroy(), qrtplib::RTPSession::InternalCreate(), and RTCPScheduler().
void qrtplib::RTCPScheduler::ScheduleBYEPacket | ( | std::size_t | packetsize | ) |
Asks the scheduler to schedule an RTCP compound packet containing a BYE packetl; the compound packet has size packetsize
.
Definition at line 362 of file rtcpscheduler.cpp.
References avgbyepacketsize, byemembers, byescheduled, CalculateBYETransmissionInterval(), qrtplib::RTPTime::CurrentTime(), firstcall, qrtplib::RTPSources::GetActiveMemberCount(), qrtplib::RTCPSchedulerParams::GetRequestImmediateBYE(), headeroverhead, nextrtcptime, pbyemembers, pmembers, prevrtcptime, schedparams, sendbyenow, and sources.
Referenced by qrtplib::RTPSession::BYEDestroy(), and qrtplib::RTPSession::ProcessPolledData().
|
inline |
Sets the header overhead from underlying protocols (for example UDP and IP) to numbytes
.
Definition at line 154 of file rtcpscheduler.h.
Referenced by qrtplib::RTPSession::InternalCreate().
|
inline |
Sets the scheduler parameters to be used to params
.
Definition at line 142 of file rtcpscheduler.h.
Referenced by qrtplib::RTPSession::InternalCreate(), and qrtplib::RTPSession::SetSessionBandwidth().
|
private |
Definition at line 216 of file rtcpscheduler.h.
Referenced by AnalyseIncoming(), CalculateBYETransmissionInterval(), RTCPScheduler(), and ScheduleBYEPacket().
|
private |
Definition at line 206 of file rtcpscheduler.h.
Referenced by AnalyseIncoming(), AnalyseOutgoing(), CalculateDeterministicInterval(), and Reset().
|
private |
Definition at line 215 of file rtcpscheduler.h.
Referenced by AnalyseIncoming(), CalculateBYETransmissionInterval(), RTCPScheduler(), and ScheduleBYEPacket().
|
private |
Definition at line 214 of file rtcpscheduler.h.
Referenced by AnalyseIncoming(), CalculateBYETransmissionInterval(), IsTime(), Reset(), and ScheduleBYEPacket().
|
private |
Definition at line 208 of file rtcpscheduler.h.
Referenced by GetTransmissionDelay(), IsTime(), PerformReverseReconsideration(), Reset(), and ScheduleBYEPacket().
|
private |
Definition at line 207 of file rtcpscheduler.h.
Referenced by AnalyseOutgoing(), CalculateDeterministicInterval(), and Reset().
|
private |
Definition at line 205 of file rtcpscheduler.h.
Referenced by AnalyseIncoming(), AnalyseOutgoing(), Reset(), and ScheduleBYEPacket().
|
private |
Definition at line 209 of file rtcpscheduler.h.
Referenced by CalculateNextRTCPTime(), GetTransmissionDelay(), IsTime(), PerformReverseReconsideration(), and ScheduleBYEPacket().
|
private |
Definition at line 215 of file rtcpscheduler.h.
Referenced by RTCPScheduler(), and ScheduleBYEPacket().
|
private |
Definition at line 211 of file rtcpscheduler.h.
Referenced by ActiveMemberDecrease(), GetTransmissionDelay(), IsTime(), PerformReverseReconsideration(), RTCPScheduler(), and ScheduleBYEPacket().
|
private |
Definition at line 210 of file rtcpscheduler.h.
Referenced by GetTransmissionDelay(), IsTime(), PerformReverseReconsideration(), and ScheduleBYEPacket().
|
private |
Definition at line 219 of file rtcpscheduler.h.
Referenced by CalculateBYETransmissionInterval(), and CalculateTransmissionInterval().
|
private |
Definition at line 204 of file rtcpscheduler.h.
Referenced by CalculateBYETransmissionInterval(), CalculateDeterministicInterval(), and ScheduleBYEPacket().
|
private |
Definition at line 217 of file rtcpscheduler.h.
Referenced by CalculateBYETransmissionInterval(), Reset(), and ScheduleBYEPacket().
|
private |
Definition at line 203 of file rtcpscheduler.h.
Referenced by ActiveMemberDecrease(), CalculateDeterministicInterval(), CalculateNextRTCPTime(), GetTransmissionDelay(), IsTime(), PerformReverseReconsideration(), and ScheduleBYEPacket().