IncomingDataQueue(3)
okay so bestie, welcome to IncomingDataQueue(3) β a Library Functions Manual page, section 3, and it's lowkey a big one, so buckle up. It's all about a queue for incoming RTP data packets in an RTP session. No cap. β¨
π NAME π
IncomingDataQueue β a Queue for incoming RTP data packets in an RTP session. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <iqueue.h>
okay so the family tree situation: it Inherits IncomingDataQueueBase, and MembershipBookkeeping. And it's Inherited by RTPDataQueue. it's giving nepo baby but make it C++ inheritance. π
π¦ Classes π¦
class SyncSourcesIteratorβ iterator through the list of synchronizations sources in this session. so you can loop through the sources, cute.
β¨ Public Member Functions β¨
SyncSourcesIterator begin ()β where the iterator starts.SyncSourcesIterator end ()β where it stops, classic.const AppDataUnit * getData (uint32 stamp, const SyncSource *src=NULL)β Retreive data from a specific timestamped packet if such a packet is currently available in the receive buffer. note the exact defaultsrc=NULL.bool isWaiting (const SyncSource *src=NULL) constβ Determine if packets are waiting in the reception queue. the queue said "hold on".uint32 getFirstTimestamp (const SyncSource *src=NULL) constβ Get timestamp of first packet waiting in the queue.void setMinValidPacketSequence (uint8 packets)β When receiving packets from a new source, it may be convenient to reject a first few packets before we are really sure the source is valid. trust issues, but make it RTP.uint8 getDefaultMinValidPacketSequence () constβ the default one.uint8 getMinValidPacketSequence () constβ Get the minimun number of consecutive packets that must be received from a source before accepting its data packets.void setMaxPacketMisorder (uint16 packets)β how much out-of-order chaos we tolerate.uint16 getDefaultMaxPacketMisorder () constuint16 getMaxPacketMisorder () constvoid setMaxPacketDropout (uint16 packets)β It also prevents packets sent after a restart of the source being immediately accepted.uint16 getDefaultMaxPacketDropout () constuint16 getMaxPacketDropout () constvoid setInQueueCryptoContext (CryptoContext *cc)β Set input queue CryptoContext. πvoid removeInQueueCryptoContext (CryptoContext *cc)β Remove input queue CryptoContext.CryptoContext * getInQueueCryptoContext (uint32 ssrc)β Get an input queue CryptoContext identified by SSRC. identified by thessrc, bestie.
π Public Member Functions inherited from IncomingDataQueueBase π
size_t getDefaultMaxRecvPacketSize () constsize_t getMaxRecvPacketSize () constvoid setMaxRecvPacketSize (size_t maxsize)
π Public Member Functions inherited from RTPQueueBase π
bool setPayloadFormat (const PayloadFormat &pf)β Set the payload format in use, for timing and payload type identification purposes.uint32 getLocalSSRC () constuint32 getCurrentRTPClockRate () constβ Get the clock rate in RTP clock units (for instance, 8000 units per second for PCMU, or 90000 units per second for MP2T). yes those exact numbers, keep them.PayloadType getCurrentPayloadType () consttimeval getInitialTime () const
β Static Public Member Functions β
static size_t getDefaultMembersSize ()
π₯ Protected Member Functions π₯
IncomingDataQueue (uint32 size)β constructor, protected, we'll get to it below.virtual ~IncomingDataQueue ()β destructor, also protected.bool checkSSRCInIncomingRTPPkt (SyncSourceLink &sourceLink, bool is_new, InetAddress &na, tpport_t tp)β Apply collision and loop detection and correction algorithm when receiving RTP data packets. collision + loop detection is doing the absolute most and it should.void setSourceExpirationPeriod (uint8 intervals)β Set the number of RTCP intervals that the stack will wait to change the state of a source fromstateActivetostateInactive, or to delete the source after being instateInactive.virtual size_t takeInDataPacket ()β This function is used by the service thread to process the next incoming packet and place it in the receive list.void renewLocalSSRC ()IncomingDataQueue::IncomingRTPPktLink * getWaiting (uint32 timestamp, const SyncSource *src=NULL)β This is used to fetch a packet in the receive queue and to expire packets older than the current timestamp. expired packets, gone, blocked, unfollowed.bool recordReception (SyncSourceLink &srcLink, const IncomingRTPPkt &pkt, const timeval recvtime)β Log reception of a new RTP packet from this source.void recordExtraction (const IncomingRTPPkt &pkt)β Log extraction of a packet from this source from the scheduled reception queue.void purgeIncomingQueue ()virtual void onNewSyncSource (const SyncSource &)β Virtual called when a new synchronization source has joined the session. new source just joined the group chat.virtual bool onRTPPacketRecv (IncomingRTPPkt &)β A virtual function to support parsing of arriving packets to determine if they should be kept in the queue and to dispatch events.virtual void onExpireRecv (IncomingRTPPkt &)β A hook to filter packets in the receive queue that are being expired.virtual bool onSRTPPacketError (IncomingRTPPkt &pkt, int32 errorCode)β A hook that gets called if the decoding of an incoming SRTP was erroneous. something went wrong decoding, and it tells you.virtual bool end2EndDelayed (IncomingRTPPktLink &)bool insertRecvPacket (IncomingRTPPktLink *packetLink)β Insert a just received packet in the queue (both general and source specific queues).virtual size_t recvData (unsigned char *buffer, size_t length, InetHostAddress &host, tpport_t &port)=0β This function performs the physical I/O for reading a packet from the source. pure virtual,=0, so you have to implement it.virtual size_t getNextDataPacketSize () const =0β also pure virtual=0.
π Protected Member Functions inherited from IncomingDataQueueBase π
IncomingDataQueueBase ()virtual ~IncomingDataQueueBase ()
π§ Protected Member Functions inherited from RTPQueueBase π§
RTPQueueBase (uint32 *ssrc=NULL)void setLocalSSRC (uint32 ssrc)uint32 getLocalSSRCNetwork () constvirtual ~RTPQueueBase ()virtual size_t dispatchBYE (const std::string &)β A plugin point for posting of BYE messages. bye bestie π
π Protected Member Functions inherited from MembershipBookkeeping π
MembershipBookkeeping (uint32 initialSize=defaultMembersHashSize)β The initial size is a hint to allocate the resources needed in order to keep the members' identifiers and associated information.virtual ~MembershipBookkeeping ()β Purges allRTPSourcestructures created during the session, as well as the hash table and the list of sources. everything gets cleared out.SyncSourceLink * getLink (const SyncSource &source) constbool isMine (const SyncSource &source) constβ Get whether a synchronization source is recorded in this membership controller.bool isRegistered (uint32 ssrc)β Returns whether there is already a synchronizacion source with'ssrc'SSRC identifier.SyncSourceLink * getSourceBySSRC (uint32 ssrc, bool &created)β Get the description of a source by itsssrcidentifier.bool BYESource (uint32 ssrc)β Mark the source identified byssrcas having sent a BYE packet.bool removeSource (uint32 ssrc)β Remove the description of the source identified byssrcSyncSourceLink * getFirst ()SyncSourceLink * getLast ()uint32 getMembersCount ()void setMembersCount (uint32 n)uint32 getSendersCount ()size_t getDefaultMembersHashSize ()
π Protected Member Functions inherited from SyncSourceHandler π
SyncSourceHandler ()virtual ~SyncSourceHandler ()void * getLink (const SyncSource &source) constβ This requiresSyncSource-SyncSourceHandlerfriendship. friendship, the C++ kind.void setLink (SyncSource &source, void *link)void setParticipant (SyncSource &source, Participant &p)void setState (SyncSource &source, SyncSource::State ns)void setSender (SyncSource &source, bool active)void setDataTransportPort (SyncSource &source, tpport_t p)void setControlTransportPort (SyncSource &source, tpport_t p)void setNetworkAddress (SyncSource &source, InetAddress addr)
πΈ Protected Member Functions inherited from ParticipantHandler πΈ
ParticipantHandler ()virtual ~ParticipantHandler ()void setSDESItem (Participant *part, SDESItemType item, const std::string &val)void setPRIVPrefix (Participant *part, const std::string val)
π¦ Protected Member Functions inherited from ApplicationHandler π¦
ApplicationHandler ()virtual ~ApplicationHandler ()void addParticipant (RTPApplication &app, Participant &part)void removeParticipant (RTPApplication &app, RTPApplication::ParticipantLink *pl)
π Protected Member Functions inherited from ConflictHandler π
ConflictHandler ()virtual ~ConflictHandler ()ConflictingTransportAddress * searchDataConflict (InetAddress na, tpport_t dtp)ConflictingTransportAddress * searchControlConflict (InetAddress na, tpport_t ctp)void updateConflict (ConflictingTransportAddress &ca)void addConflict (const InetAddress &na, tpport_t dtp, tpport_t ctp)
π Protected Attributes π
ThreadLock recvLockIncomingRTPPktLink * recvFirstIncomingRTPPktLink * recvLastuint8 minValidPacketSequenceuint16 maxPacketMisorderuint16 maxPacketDropoutuint8 sourceExpirationPeriodMutex cryptoMutexstd::list< CryptoContext * > cryptoContexts
π Protected Attributes inherited from ConflictHandler π
ConflictingTransportAddress * firstConflictConflictingTransportAddress * lastConflict
β Static Protected Attributes β
static const uint8 defaultMinValidPacketSequencestatic const uint16 defaultMaxPacketMisorderstatic const uint16 defaultMaxPacketDropoutstatic const size_t defaultMembersSize
π« Static Protected Attributes inherited from MembershipBookkeeping π«
static const size_t defaultMembersHashSizestatic const uint32 SEQNUMMOD
π Detailed Description π
Queue for incoming RTP data packets in an RTP session. that's literally the whole thing, and honestly? iconic. π
βοΈ Author
Federico Montesino Pouzols fedemp@altern.org ty for your service, king. π«Ά
π οΈ Constructor & Destructor Documentation π οΈ
π IncomingDataQueue::IncomingDataQueue (uint32 size) [protected] π
Parameters:
sizeβ initial size of the membership table. that's the hint for how big the membership table starts out.
π virtual IncomingDataQueue::~IncomingDataQueue () [inline], [protected], [virtual] π
and that's the destructor β inline, protected, virtual, the whole trio. no parameters listed, so there's nothing else to spill. π
hang tight bestie, this page is long and it comes in 3 parts β and this was part 1. more incoming β¨
π MEMBER FUNCTION DOCUMENTATION π
okay bestie, this is the big one β every single member function, no skips, we're doing the whole thing β¨
SyncSourcesIterator IncomingDataQueue::begin () [inline]
(no description here, she's just vibing π¦)
bool IncomingDataQueue::checkSSRCInIncomingRTPPkt (SyncSourceLink & sourceLink, bool is_new, InetAddress & na, tpport_t tp) [protected]
This one applies the collision and loop detection and correction algorithm when receiving RTP data packets. It follows section 8.2 in draft-ietf-avt-rtp-new. literally the whole protocol-boss move π
Parameters
sourceLinkβ link to the source object.is_newβ whether the source has been just recorded.naβ data packet network address.tpβ data packet source transport port.
Returns whether the packet must not be discarded. (yes, read that twice, the double negative is real π)
SyncSourcesIterator IncomingDataQueue::end () [inline]
(no description, carry on π)
virtual bool IncomingDataQueue::end2EndDelayed (IncomingRTPPktLink &) [inline], [protected], [virtual]
(no description given, she's a mystery πΈ)
const AppDataUnit * IncomingDataQueue::getData (uint32 stamp, const SyncSource * src = NULL)
Retreive data from a specific timestamped packet if such a packet is currently available in the receive buffer. β¨
Parameters
stampβ Data unit timestamp.srcβ Optional synchronization source selector.
Returns data retrieved from the reception buffer.
Return values
- null pointer if no packet with such timestamp is available.
Examples audiorx.cpp, rtpduphello.cpp, rtphello.cpp, and rtplisten.cpp.
uint16 IncomingDataQueue::getDefaultMaxPacketDropout () const [inline]
(no description, just a getter doing getter things π)
uint16 IncomingDataQueue::getDefaultMaxPacketMisorder () const [inline]
(no description π¦)
static size_t IncomingDataQueue::getDefaultMembersSize () [inline], [static]
(no description β)
uint8 IncomingDataQueue::getDefaultMinValidPacketSequence () const [inline]
(no description πΈ)
uint32 IncomingDataQueue::getFirstTimestamp (const SyncSource * src = NULL) const
Get timestamp of first packet waiting in the queue. the OG timestamp bestie π
Parameters
srcβ optional source selector.
Returns timestamp of first arrival packet.
Examples audiorx.cpp, rtpduphello.cpp, rtphello.cpp, and rtplisten.cpp.
CryptoContext * IncomingDataQueue::getInQueueCryptoContext (uint32 ssrc)
Get an input queue CryptoContext identified by SSRC. π
Parameters
ssrcβ RequestCryptoContextfor this incoming SSRC
Returns Pointer to CryptoContext of the SSRC of NULL if no context available for this SSRC.
uint16 IncomingDataQueue::getMaxPacketDropout () const [inline]
(no description π )
uint16 IncomingDataQueue::getMaxPacketMisorder () const [inline]
(no description π)
uint8 IncomingDataQueue::getMinValidPacketSequence () const [inline]
Get the minimun number of consecutive packets that must be received from a source before accepting its data packets.
virtual size_t IncomingDataQueue::getNextDataPacketSize () const [protected], [pure virtual]
Implemented in RTPDuplex, TRTPSessionBase< RTPDataChannel, RTCPChannel, ServiceQueue >, and TRTPSessionBase< DualRTPUDPIPv4Channel, DualRTPUDPIPv4Channel, AVPQueue >.
IncomingDataQueue::IncomingRTPPktLink * IncomingDataQueue::getWaiting (uint32 timestamp, const SyncSource * src = NULL) [protected]
This is used to fetch a packet in the receive queue and to expire packets older than the current timestamp. bye felicia to the old ones π
Returns packet buffer object for current timestamp if found.
Parameters
timestampβ timestamp requested.srcβ optional source selector
Note β if found, the packet is removed from the reception queue
bool IncomingDataQueue::insertRecvPacket (IncomingRTPPktLink * packetLink) [protected]
Insert a just received packet in the queue (both general and source specific queues). If the packet was already in the queue (same SSRC and sequence number), it is not inserted but deleted. no duplicates allowed, periodt π
Parameters
packetLinkβ link to a packet just received and generally validated and processed byonRTPPacketRecv.
Returns whether the packet was successfully inserted.
Return values
falsewhen the packet is duplicated (there is already a packet from the same source with the same timestamp).truewhen the packet is not duplicated.
bool IncomingDataQueue::isWaiting (const SyncSource * src = NULL) const
Determine if packets are waiting in the reception queue. vibe check on the queue π«Ά
Parameters
srcβ Optional synchronization source selector.
Returns True if packets are waiting.
virtual void IncomingDataQueue::onExpireRecv (IncomingRTPPkt &) [inline], [protected], [virtual]
A hook to filter packets in the receive queue that are being expired. This hook may be used to do some application specific processing on expired packets before they are deleted. last-chance era β¨
Parameters
- packet expired from the recv queue.
virtual void IncomingDataQueue::onNewSyncSource (const SyncSource &) [inline], [protected], [virtual]
Virtual called when a new synchronization source has joined the session. new bestie just walked in π
Parameters
- new synchronization source
Examples rtplisten.cpp.
virtual bool IncomingDataQueue::onRTPPacketRecv (IncomingRTPPkt &) [inline], [protected], [virtual]
A virtual function to support parsing of arriving packets to determine if they should be kept in the queue and to dispatch events. A generic header validity check (as specified in RFC 1889) is performed on every incoming packet. If the generic check completes successfully, this method is called before the packet is actually inserted into the reception queue. so real β the packet doesn't get in until this girl says so π
May be used to perform additional validity checks or to do some application specific processing.
Parameters
- packet just received.
Returns true if packet is kept in the incoming packets queue.
virtual bool IncomingDataQueue::onSRTPPacketError (IncomingRTPPkt & pkt, int32 errorCode) [inline], [protected], [virtual]
A hook that gets called if the decoding of an incoming SRTP was erroneous. uh oh π
Parameters
pktβ The SRTP packet with error.errorCodeβ The error code:-1- SRTP authentication failure,-2- replay check failed
Returns True: put the packet in incoming queue for further processing by the applications; false: dismiss packet. The default implementation returns false.
void IncomingDataQueue::purgeIncomingQueue () [protected]
(no description β she just purges π)
void IncomingDataQueue::recordExtraction (const IncomingRTPPkt & pkt) [protected]
Log extraction of a packet from this source from the scheduled reception queue. π
Parameters
pktβ Packet extracted from the queue.
bool IncomingDataQueue::recordReception (SyncSourceLink & srcLink, const IncomingRTPPkt & pkt, const timeval recvtime) [protected]
Log reception of a new RTP packet from this source. Usually updates data such as the packet counter, the expected sequence number for the next packet and the time the last packet was received at. keeping receipts, literally π§Ύ
Parameters
srcLinkβ Link structure for the synchronization source of this packet.pktβ Packet just created and to be logged.recvtimeβ Reception time.
Returns whether, according to the source state and statistics, the packet is considered valid and must be inserted in the incoming packets queue.
virtual size_t IncomingDataQueue::recvData (unsigned char * buffer, size_t length, InetHostAddress & host, tpport_t & port) [protected], [pure virtual]
This function performs the physical I/O for reading a packet from the source. It is a virtual that is overridden in the derived class. the actual hands-on-grabbing-the-bytes moment π₯
Returns number of bytes read.
Parameters
- buffer of read packet.
- length of data to read.
- host address of source.
- port number of source.
Implemented in RTPDuplex, TRTPSessionBase< RTPDataChannel, RTCPChannel, ServiceQueue >, and TRTPSessionBase< DualRTPUDPIPv4Channel, DualRTPUDPIPv4Channel, AVPQueue >.
void IncomingDataQueue::removeInQueueCryptoContext (CryptoContext * cc)
Remove input queue CryptoContext. The endQueue method (provided by RTPQueue) also deletes all registered CryptoContexts.
Parameters
ccβ Pointer to initializedCryptoContextto remove. If pointer ifNULLthen delete the whole queue
void IncomingDataQueue::renewLocalSSRC () [protected], [virtual]
Reimplemented from RTPQueueBase.
Reimplemented in RTPDataQueue.
void IncomingDataQueue::setInQueueCryptoContext (CryptoContext * cc)
Set input queue CryptoContext. The endQueue method (provided by RTPQueue) deletes all registered CryptoContexts.
Parameters
ccβ Pointer to initializedCryptoContext.
void IncomingDataQueue::setMaxPacketDropout (uint16 packets) [inline]
It also prevents packets sent after a restart of the source being immediately accepted. π
void IncomingDataQueue::setMaxPacketMisorder (uint16 packets) [inline]
(no description π)
void IncomingDataQueue::setMinValidPacketSequence (uint8 packets) [inline]
When receiving packets from a new source, it may be convenient to reject a first few packets before we are really sure the source is valid. This method sets how many data packets must be received in sequence before the source is considered valid and the stack starts to accept its packets. trust issues but make it protocol β
Note - the default (seedefaultMinValidPacketSequence()) value for this parameter is0, so that no packets are rejected (data packets are accepted from the first one). - this validation is performed after the generic header validation and the additional validation done inonRTPPacketRecv(). - if any valid RTCP packet is received from this source, it will be immediatly considered valid regardless of the number of sequential data packets received.
Parameters
packetsβ number of sequential packet required
void IncomingDataQueue::setSourceExpirationPeriod (uint8 intervals) [inline], [protected]
Set the number of RTCP intervals that the stack will wait to change the state of a source from stateActive to stateInactive, or to delete the source after being in stateInactive. Note that this value should be uniform accross all participants and SHOULD be fixed for a particular profile. consistency is key bestie π
Parameters
intervalsβ number of RTCP report intervals
Note - If RTCP is not being used, the RTCP interval is assumed to be the default:5seconds. - The default for this value is, as RECOMMENDED,5.
virtual size_t IncomingDataQueue::takeInDataPacket () [protected], [virtual]
This function is used by the service thread to process the next incoming packet and place it in the receive list. π«Ά
Returns number of payload bytes received. <0 if error.
Reimplemented in SingleThreadRTPSession< RTPDataChannel, RTCPChannel, ServiceQueue >.
Member Data Documentation π
okay bestie, this is the data-member part. Doxygen gave us the exact types and qualifiers but literally no descriptions for these, so we're keeping every detail and not inventing behavior. no cap. π«Ά
std::list<CryptoContext *>IncomingDataQueue::cryptoContextsβ[protected]. It's astd::listofCryptoContext *pointers, protected. That's the entire tea. β¨MutexIncomingDataQueue::cryptoMutexβ[mutable],[protected]. AMutex, mutable and protected. The docs said "that's it," so we respect it. πconst uint16IncomingDataQueue::defaultMaxPacketDropoutβ[static],[protected]. const uint16, static, protected. A whole default, locked down. πconst uint16IncomingDataQueue::defaultMaxPacketMisorderβ[static],[protected]. const uint16, static, protected. Default max packet misorder, doing its default thing. πΈconst size_tIncomingDataQueue::defaultMembersSizeβ[static],[protected]. const size_t, static, protected. Size default, but make it protected. πconst uint8IncomingDataQueue::defaultMinValidPacketSequenceβ[static],[protected]. const uint8, static, protected. The name is long, the type is small, the qualifiers are real. πuint16IncomingDataQueue::maxPacketDropoutβ[protected]. uint16, protected. No const, no static, just vibes and protection. πuint16IncomingDataQueue::maxPacketMisorderβ[protected]. uint16, protected. Max misorder, but make it protected. π¦uint8IncomingDataQueue::minValidPacketSequenceβ[protected]. uint8, protected. Tiny type, big name energy. βIncomingRTPPktLink*IncomingDataQueue::recvFirstβ[protected]. A pointer toIncomingRTPPktLink, protected. First recv link, apparently. π₯IncomingRTPPktLink *IncomingDataQueue::recvLastβ[protected]. Same pointer energy, protected. Last recv link, literally. πThreadLockIncomingDataQueue::recvLockβ[mutable],[protected]. A mutable protectedThreadLock. Lock it up, bestie. πuint8IncomingDataQueue::sourceExpirationPeriodβ[protected]. uint8, protected. Source expiration period, tiny type and all. π
Author π
This page was generated automatically by Doxygen for ccRTP from the source code. So the author credit is Doxygen + ccRTP, and that's iconic. π
okay bye bestie! This came from ccRTP and it's IncomingDataQueue(3). The footer didn't show a date, so no fake date β just love, no cap. π«Άβ¨
π¦ where this page comes from
- debian trixie: libccrtp-doc 2.0.9-4.1 Β· GPL-2.0-or-later WITH MIF exception
- ubuntu noble: libccrtp-doc 2.0.9-2.5build1
- ubuntu questing: libccrtp-doc 2.0.9-4.1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms