RTPDuplex(3)
๐ธ RTPDuplex(3) ๐ธ
okay bestie, so this one lives in the Library Functions Manual and it's called RTPDuplex ๐
โจ NAME โจ
RTPDuplex โ a peer-associated RTP socket pair for physically connected peer hosts. like, two sockets that are literally vibing with each other, no cap ๐ฆ
โจ SYNOPSIS โจ
#include <cc++/rtp.h>
Inherits RTPDataQueue, UDPReceive, and UDPTransmit. yeah she's got main character energy and a whole family tree ๐
๐ Public Member Functions
RTPDuplex (const InetAddress &bind, tpport_t local, tpport_t remote)โ the glow-up constructor, no description attached, we move โจvirtual ~RTPDuplex ()โ the destructor, she exits gracefully ๐UDPTransmit::Error connect (const InetHostAddress &host, tpport_t port=0)โ link up with a host,portdefaults to0๐ซถ
๐ Public Member Functions inherited from RTPDataQueue
void setTypeOfService (Tos tos)โ tell the world what kind of service your app is expecting to use ๐void enableStack ()โ turn ON packet queue processing in the stack โญvoid disableStack ()โ turn OFF packet queue processing in the stack ๐คbool isActive () constโ check that active connection state flag, is she awake or not ๐uint32 getCurrentTimestamp () constโ grab the timestamp you should slap on a packet whose payload sampling instant lines up with the current system time โฐvoid setSessionBandwidth (uint32 bw)โ set the bandwidth of the current session ๐ถuint32 getDefaultSessionBandwidth () constโ the default, as advertised ๐uint32 getSessionBandwidth () constโ the current one, fr fr ๐void setTimeclock ()โ set the packet timeclock so timestamps stay in sync ๐ฐ๏ธtimeout_t getTimeclock () constโ get that same packet timeclock back โจ
๐ Public Member Functions inherited from IncomingDataQueue
SyncSourcesIterator begin ()โ start of the iterator, let's gooo ๐SyncSourcesIterator end ()โ end of the iterator, and that's the vibe ๐ฆconst AppDataUnit * getData (uint32 stamp, const SyncSource *src=NULL)โ pull data out of a specific timestamped packet, but only if such a packet is actually hanging out in the receive buffer right now;srcdefaults toNULL๐bool isWaiting (const SyncSource *src=NULL) constโ are packets chilling in the reception queue?srcdefaults toNULL๐uint32 getFirstTimestamp (const SyncSource *src=NULL) constโ timestamp of the first packet waiting in the queue;srcdefaults toNULL๐void setMinValidPacketSequence (uint8 packets)โ when packets arrive from a new source it can be handy to reject the first few before you're actually sure the source is valid ๐งuint8 getDefaultMinValidPacketSequence () constโ the default min valid packet sequence โจuint8 getMinValidPacketSequence () constโ get the minimum number of consecutive packets that must show up from a source before its data packets get accepted, periodt ๐void setMaxPacketMisorder (uint16 packets)โ set the max packet misorder ๐uint16 getDefaultMaxPacketMisorder () constโ the default max packet misorder โญuint16 getMaxPacketMisorder () constโ get the max packet misorder ๐ซvoid setMaxPacketDropout (uint16 packets)โ also stops packets sent after a source restart from being accepted immediately, sneaky ๐ซuint16 getDefaultMaxPacketDropout () constโ the default max packet dropout ๐uint16 getMaxPacketDropout () constโ get the max packet dropout ๐void setInQueueCryptoContext (CryptoContext *cc)โ set the input queueCryptoContext๐void removeInQueueCryptoContext (CryptoContext *cc)โ remove the input queueCryptoContext๐๏ธCryptoContext * getInQueueCryptoContext (uint32 ssrc)โ get an input queueCryptoContextby its SSRC ๐
๐ Public Member Functions inherited from IncomingDataQueueBase
size_t getDefaultMaxRecvPacketSize () constโ the default max recv packet size ๐ฆsize_t getMaxRecvPacketSize () constโ the current max recv packet size ๐ฌvoid setMaxRecvPacketSize (size_t maxsize)โ set that max recv packet size, go off โจ
๐ 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 () constโ grab the local SSRC ๐ชชuint32 getCurrentRTPClockRate () constโ clock rate in RTP clock units, like8000units per second for PCMU or90000units per second for MP2T โฑ๏ธPayloadType getCurrentPayloadType () constโ the current payload type ๐ท๏ธtimeval getInitialTime () constโ the initial time ๐
๐ Public Member Functions inherited from OutgoingDataQueue
bool addDestination (const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)โ add a host destination;dataPortdefaults toDefaultRTPDataPort,controlPortdefaults to0๐ฎbool addDestination (const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)โ add a multicast destination; same defaults,dataPort=DefaultRTPDataPort,controlPort=0๐กbool forgetDestination (const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)โ forget a host destination, bye bestie ๐bool forgetDestination (const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)โ forget a multicast destination, same energy ๐void addContributor (uint32 csrc)โ addcsrcas the CSRC identifier of a new contributor ๐bool removeContributor (uint32 csrc)โ remove that CSRC from the contributors list ๐ชbool isSending () constโ are outgoing packets waiting to send? ๐void putData (uint32 stamp, const unsigned char *data=NULL, size_t len=0)โ this is how you create a data packet in the send queue;datadefaults toNULL,lendefaults to0๐void sendImmediate (uint32 stamp, const unsigned char *data=NULL, size_t len=0)โ create a data packet AND send it immediately, no waiting around ๐void setPadding (uint8 paddinglen)โ set padding ๐๏ธvoid setMark (bool mark)โ set the marker bit for the packet in which the next data you provide will be sent ๐bool getMark () constโ find out whether the mark bit will be set in the next packet โsize_t setPartial (uint32 timestamp, unsigned char *data, size_t offset, size_t max)โ set partial data for a packet that's already queued ๐งฉmicrotimeout_t getDefaultSchedulingTimeout () constโ the default scheduling timeout โณvoid setSchedulingTimeout (microtimeout_t to)โ set the default scheduling timeout to use when no data packets are waiting to be sent ๐ดmicrotimeout_t getDefaultExpireTimeout () constโ the default expire timeout โvoid setExpireTimeout (microtimeout_t to)โ set the 'expired' timer, which expires packets pending in the send queue that have gone unsent and are already 'too late' to be sent now ๐ญmicrotimeout_t getExpireTimeout () constโ get the expire timeout ๐ฐ๏ธuint32 getSendPacketCount () constโ total number of packets sent so far, flex ๐uint32 getSendOctetCount () constโ total number of octets sent so far, payload only ๐ขuint16 getSequenceNumber () constโ sequence number of the next outgoing packet ๐ขvoid setOutQueueCryptoContext (CryptoContext *cc)โ set the output queueCryptoContext๐void removeOutQueueCryptoContext (CryptoContext *cc)โ remove the output queueCryptoContext๐๏ธCryptoContext * getOutQueueCryptoContext (uint32 ssrc)โ get an output queueCryptoContextidentified by SSRC ๐
๐ Public Member Functions inherited from OutgoingDataQueueBase
size_t getDefaultMaxSendSegmentSize ()โ the default max send segment size ๐void setMaxSendSegmentSize (size_t size)โ set the maximum payload segment size before sends get fragmented, we love boundaries โ๏ธsize_t getMaxSendSegmentSize ()โ the current max send segment size ๐
๐ Protected Member Functions
bool isPendingData (microtimeout_t timeout)โ is there pending data? โฒ๏ธsize_t sendData (const unsigned char *const buffer, size_t len)โ send some data ๐คsize_t recvData (unsigned char *buffer, size_t len, InetHostAddress &na, tpport_t &tp)โ receive some data ๐ฅvoid setDataPeer (const InetAddress &, tpport_t)โ set the data peer ๐คvoid setControlPeer (const InetAddress &, tpport_t)โ set the control peer ๐๏ธsize_t getNextDataPacketSize () constโ size of the next data packet ๐SyncSource & getPeer ()โ grab the peer ๐ซถ
๐
Protected Member Functions inherited from RTPDataQueue
RTPDataQueue (uint32 size=defaultMembersHashSize)โ the constructor;sizedefaults todefaultMembersHashSize๐๏ธRTPDataQueue (uint32 *ssrc, uint32 size=defaultMembersHashSize)โ with this constructor you can start a session with a givenssrcinstead of the usual randomly generated one, custom queen energy;sizedefaults todefaultMembersHashSize๐ฒvirtual ~RTPDataQueue ()โ the queue destructor flushes the queue and stops all services, she cleans up after herself ๐งนvirtual void timerTick ()โ a plugin point for timer tick driven events โฐvoid renewLocalSSRC ()โ renew the local SSRC ๐void endQueue ()โ this method ends the queue, that's it that's the method ๐
๐
Protected Member Functions inherited from IncomingDataQueue
IncomingDataQueue (uint32 size)โ constructor, takes asize๐๏ธvirtual ~IncomingDataQueue ()โ destructor ๐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 ๐void setSourceExpirationPeriod (uint8 intervals)โ set how many RTCP intervals the stack will wait to flip a source fromstateActivetostateInactive, or to delete the source after it's been instateInactive๐ฐ๏ธvirtual size_t takeInDataPacket ()โ used by the service thread to process the next incoming packet and drop it in the receive list ๐งบIncomingDataQueue::IncomingRTPPktLink * getWaiting (uint32 timestamp, const SyncSource *src=NULL)โ fetch a packet in the receive queue and expire packets older than the current timestamp;srcdefaults toNULLโ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 out of the scheduled reception queue ๐คvoid purgeIncomingQueue ()โ purge the incoming queue ๐งผvirtual void onNewSyncSource (const SyncSource &)โ virtual, called when a new synchronization source joins the session ๐virtual bool onRTPPacketRecv (IncomingRTPPkt &)โ a virtual function to help parse arriving packets, deciding whether 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 decoding an incoming SRTP was erroneous ๐ญvirtual bool end2EndDelayed (IncomingRTPPktLink &)โ end-to-end delayed hook ๐ขbool insertRecvPacket (IncomingRTPPktLink *packetLink)โ insert a just-received packet into the queue, both the general queue and the source-specific queue ๐งท
๐
Protected Member Functions inherited from IncomingDataQueueBase
IncomingDataQueueBase ()โ constructor ๐๏ธvirtual ~IncomingDataQueueBase ()โ destructor ๐
๐
Protected Member Functions inherited from RTPQueueBase
RTPQueueBase (uint32 *ssrc=NULL)โ constructor;ssrcdefaults toNULL๐๏ธvoid setLocalSSRC (uint32 ssrc)โ set the local SSRC ๐ชชuint32 getLocalSSRCNetwork () constโ get the local SSRC network ๐virtual ~RTPQueueBase ()โ destructor ๐virtual size_t dispatchBYE (const std::string &)โ a plugin point for posting of BYE messages ๐
๐ซถ Protected Member Functions inherited from MembershipBookkeeping
MembershipBookkeeping (uint32 initialSize=defaultMembersHashSize)โ okay so this initial size is just a hint, bestie: it helps allocate the resources needed to keep the members' identifiers and associated info. โจvirtual ~MembershipBookkeeping ()โ purges everyRTPSourcestructure created during the session, plus the hash table and the list of sources. ๐SyncSourceLink * getLink (const SyncSource &source) constโ signature only, iykyk.bool isMine (const SyncSource &source) constโ tells you whether a synchronization source is recorded in this membership controller. ๐bool isRegistered (uint32 ssrc)โ returns whether there is already a synchronization source with the'ssrc'SSRC identifier.SyncSourceLink * getSourceBySSRC (uint32 ssrc, bool &created)โ gets the description of a source by itsssrcidentifier.bool BYESource (uint32 ssrc)โ marks the source identified byssrcas having sent a BYE packet. ๐bool removeSource (uint32 ssrc)โ removes the description of the source identified byssrc.SyncSourceLink * getFirst ()โ signature only.SyncSourceLink * getLast ()โ signature only.uint32 getMembersCount ()โ signature only.void setMembersCount (uint32 n)โ signature only.uint32 getSendersCount ()โ signature only.size_t getDefaultMembersHashSize ()โ signature only.
๐ฆ Protected Member Functions inherited from SyncSourceHandler
SyncSourceHandler ()virtual ~SyncSourceHandler ()void * getLink (const SyncSource &source) constโ this one requiresSyncSource-SyncSourceHandlerfriendship. ๐ค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 Member Functions inherited from OutgoingDataQueue
OutgoingDataQueue ()virtual ~OutgoingDataQueue ()void dispatchImmediate (OutgoingRTPPkt *packet)โ used to write the RTP data packet to one or more destinations. ๐ฌmicrotimeout_t getSchedulingTimeout ()โ computes the timeout period for scheduling transmission of the next packet at the'head'of the send buffer. โฐsize_t dispatchDataPacket ()โ used by the service thread to process the next outgoing packet pending in the sending queue. ๐งตvoid setNextSeqNum (uint32 seqNum)โ for those cases where the application needs a method to set the sequence number for the outgoing stream (like when implementing the RTSP PLAY command). ๐ฌuint32 getCurrentSeqNum (void)void setInitialTimestamp (uint32 ts)uint32 getInitialTimestamp ()void purgeOutgoingQueue ()
๐ง Protected Member Functions inherited from OutgoingDataQueueBase
OutgoingDataQueueBase ()virtual ~OutgoingDataQueueBase ()
๐ Protected Member Functions inherited from DestinationListHandler
void writeLockDestinationList () constbool addDestinationToList (const InetAddress &ia, tpport_t data, tpport_t control)โ locks the object before modifying it. ๐bool removeDestinationFromList (const InetAddress &ia, tpport_t dataPort, tpport_t controlPort)โ locks the object before modifying it. ๐DestinationListHandler ()~DestinationListHandler ()bool isSingleDestination () constโ tells you whether there is only a destination in the list. 1๏ธโฃTransportAddress * getFirstDestination () constvoid lockDestinationList () constvoid unlockDestinationList () const
โจ Additional Inherited Members โจ
๐ Public Types inherited from RTPDataQueue
enum Tos { tosBestEffort, tosEnhanced }โrtp.h cc++/rtp.h
โญ Static Public Member Functions inherited from IncomingDataQueue
static size_t getDefaultMembersSize ()
๐ Protected Attributes inherited from IncomingDataQueue
ThreadLock recvLockIncomingRTPPktLink * recvFirstIncomingRTPPktLink * recvLastuint8 minValidPacketSequenceuint16 maxPacketMisorderuint16 maxPacketDropoutuint8 sourceExpirationPeriodMutex cryptoMutexstd::list< CryptoContext * > cryptoContexts
๐ฆ Protected Attributes inherited from ConflictHandler
ConflictingTransportAddress * firstConflictConflictingTransportAddress * lastConflict
๐ฅ Protected Attributes inherited from OutgoingDataQueue
Mutex cryptoMutexstd::list< CryptoContext * > cryptoContexts
๐ธ Protected Attributes inherited from DestinationListHandler
std::list< TransportAddress * > destList
๐ Static Protected Attributes inherited from IncomingDataQueue
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 ๐
A peer associated RTP socket pair for physically connected peer hosts. ๐ฏโโ๏ธ
This has no RTCP and assumes the receiver is connected to a known transmitter, hence no 'foreign' packets will arrive. No cap. ๐ซ
Author
David Sugar
RTP peer host over UDP. ๐
Examples
rtpduphello.cpp.
Author
Generated automatically by Doxygen for ccRTP from the source code.
And the footer? Itโs just ccRTP and RTPDuplex(3) โ thatโs the source/version and the page, plus whatever date Doxygen stamped on it, bestie. Stay iconic. ๐
โจ
๐ฆ 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