ccRTP
Public Member Functions | Protected Member Functions | List of all members
RTPDuplex Class Reference

A peer associated RTP socket pair for physically connected peer hosts. More...

#include <cc++/rtp.h>

Inheritance diagram for RTPDuplex:
Inheritance graph
[legend]
Collaboration diagram for RTPDuplex:
Collaboration graph
[legend]

Public Member Functions

 RTPDuplex (const InetAddress &bind, tpport_t local, tpport_t remote)
 
virtual ~RTPDuplex ()
 
UDPTransmit::Error connect (const InetHostAddress &host, tpport_t port=0)
 
- Public Member Functions inherited from RTPDataQueue
void setTypeOfService (Tos tos)
 Specify the kind of service the application expects to use. More...
 
void enableStack ()
 Enable packet queue processing in the stack. More...
 
void disableStack ()
 Disable packet queue processing in the stack. More...
 
bool isActive () const
 Get active connection state flag. More...
 
uint32 getCurrentTimestamp () const
 Get the timestamp that should be given for a packet whose payload sampling instant corresponds to the current system time. More...
 
void setSessionBandwidth (uint32 bw)
 Specify the bandwidth of the current session. More...
 
uint32 getDefaultSessionBandwidth () const
 
uint32 getSessionBandwidth () const
 
void setTimeclock ()
 Set the packet timeclock for synchronizing timestamps. More...
 
timeout_t getTimeclock () const
 Get the packet timeclock for synchronizing timestamps. More...
 
- Public Member Functions inherited from IncomingDataQueue
SyncSourcesIterator begin ()
 
SyncSourcesIterator end ()
 
const AppDataUnitgetData (uint32 stamp, const SyncSource *src=NULL)
 Retreive data from a specific timestamped packet if such a packet is currently available in the receive buffer. More...
 
bool isWaiting (const SyncSource *src=NULL) const
 Determine if packets are waiting in the reception queue. More...
 
uint32 getFirstTimestamp (const SyncSource *src=NULL) const
 Get timestamp of first packet waiting in the queue. More...
 
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. More...
 
uint8 getDefaultMinValidPacketSequence () const
 
uint8 getMinValidPacketSequence () const
 Get the minimun number of consecutive packets that must be received from a source before accepting its data packets. More...
 
void setMaxPacketMisorder (uint16 packets)
 
uint16 getDefaultMaxPacketMisorder () const
 
uint16 getMaxPacketMisorder () const
 
void setMaxPacketDropout (uint16 packets)
 It also prevents packets sent after a restart of the source being immediately accepted. More...
 
uint16 getDefaultMaxPacketDropout () const
 
uint16 getMaxPacketDropout () const
 
void setInQueueCryptoContext (CryptoContext *cc)
 Set input queue CryptoContext. More...
 
void removeInQueueCryptoContext (CryptoContext *cc)
 Remove input queue CryptoContext. More...
 
CryptoContextgetInQueueCryptoContext (uint32 ssrc)
 Get an input queue CryptoContext identified by SSRC. More...
 
- Public Member Functions inherited from IncomingDataQueueBase
size_t getDefaultMaxRecvPacketSize () const
 
size_t getMaxRecvPacketSize () const
 
void 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. More...
 
uint32 getLocalSSRC () const
 
uint32 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). More...
 
PayloadType getCurrentPayloadType () const
 
timeval getInitialTime () const
 
- Public Member Functions inherited from OutgoingDataQueue
bool addDestination (const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
 
bool addDestination (const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
 
bool forgetDestination (const InetHostAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
 
bool forgetDestination (const InetMcastAddress &ia, tpport_t dataPort=DefaultRTPDataPort, tpport_t controlPort=0)
 
void addContributor (uint32 csrc)
 Add csrc as the CSRC identifier of a new contributor. More...
 
bool removeContributor (uint32 csrc)
 Remove CSRC from the list of contributors. More...
 
bool isSending () const
 Determine if outgoing packets are waiting to send. More...
 
void putData (uint32 stamp, const unsigned char *data=NULL, size_t len=0)
 This is used to create a data packet in the send queue. More...
 
void sendImmediate (uint32 stamp, const unsigned char *data=NULL, size_t len=0)
 This is used to create a data packet and send it immediately. More...
 
void setPadding (uint8 paddinglen)
 Set padding. More...
 
void setMark (bool mark)
 Set marker bit for the packet in which the next data provided will be send. More...
 
bool getMark () const
 Get whether the mark bit will be set in the next packet. More...
 
size_t setPartial (uint32 timestamp, unsigned char *data, size_t offset, size_t max)
 Set partial data for an already queued packet. More...
 
microtimeout_t getDefaultSchedulingTimeout () const
 
void setSchedulingTimeout (microtimeout_t to)
 Set the default scheduling timeout to use when no data packets are waiting to be sent. More...
 
microtimeout_t getDefaultExpireTimeout () const
 
void setExpireTimeout (microtimeout_t to)
 Set the "expired" timer for expiring packets pending in the send queue which have gone unsent and are already "too late" to be sent now. More...
 
microtimeout_t getExpireTimeout () const
 
uint32 getSendPacketCount () const
 Get the total number of packets sent so far. More...
 
uint32 getSendOctetCount () const
 Get the total number of octets (payload only) sent so far. More...
 
uint16 getSequenceNumber () const
 Get the sequence number of the next outgoing packet. More...
 
void setOutQueueCryptoContext (CryptoContext *cc)
 Set output queue CryptoContext. More...
 
void removeOutQueueCryptoContext (CryptoContext *cc)
 Remove output queue CryptoContext. More...
 
CryptoContextgetOutQueueCryptoContext (uint32 ssrc)
 Get an output queue CryptoContext identified by SSRC. More...
 
- Public Member Functions inherited from OutgoingDataQueueBase
size_t getDefaultMaxSendSegmentSize ()
 
void setMaxSendSegmentSize (size_t size)
 Set maximum payload segment size before fragmenting sends. More...
 
size_t getMaxSendSegmentSize ()
 

Protected Member Functions

bool isPendingData (microtimeout_t timeout)
 
size_t sendData (const unsigned char *const buffer, size_t len)
 
size_t recvData (unsigned char *buffer, size_t len, InetHostAddress &na, tpport_t &tp)
 
void setDataPeer (const InetAddress &, tpport_t)
 
void setControlPeer (const InetAddress &, tpport_t)
 
size_t getNextDataPacketSize () const
 
SyncSourcegetPeer ()
 
- Protected Member Functions inherited from RTPDataQueue
 RTPDataQueue (uint32 size=defaultMembersHashSize)
 Constructor. More...
 
 RTPDataQueue (uint32 *ssrc, uint32 size=defaultMembersHashSize)
 Using this constructor you can start a session with the given ssrc, instead of the usual randomly generated one. More...
 
virtual ~RTPDataQueue ()
 The queue destructor flushes the queue and stops all services. More...
 
virtual void timerTick ()
 A plugin point for timer tick driven events. More...
 
void renewLocalSSRC ()
 
void endQueue ()
 This method ends the queue. More...
 
- Protected Member Functions inherited from IncomingDataQueue
 IncomingDataQueue (uint32 size)
 
virtual ~IncomingDataQueue ()
 
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. More...
 
void setSourceExpirationPeriod (uint8 intervals)
 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. More...
 
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. More...
 
void renewLocalSSRC ()
 
IncomingDataQueue::IncomingRTPPktLinkgetWaiting (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. More...
 
bool recordReception (SyncSourceLink &srcLink, const IncomingRTPPkt &pkt, const timeval recvtime)
 Log reception of a new RTP packet from this source. More...
 
void recordExtraction (const IncomingRTPPkt &pkt)
 Log extraction of a packet from this source from the scheduled reception queue. More...
 
void purgeIncomingQueue ()
 
virtual void onNewSyncSource (const SyncSource &)
 Virtual called when a new synchronization source has joined the session. More...
 
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. More...
 
virtual void onExpireRecv (IncomingRTPPkt &)
 A hook to filter packets in the receive queue that are being expired. More...
 
virtual bool onSRTPPacketError (IncomingRTPPkt &pkt, int32 errorCode)
 A hook that gets called if the decoding of an incoming SRTP was erroneous. More...
 
virtual bool end2EndDelayed (IncomingRTPPktLink &)
 
bool insertRecvPacket (IncomingRTPPktLink *packetLink)
 Insert a just received packet in the queue (both general and source specific queues). More...
 
- 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 () const
 
virtual ~RTPQueueBase ()
 
virtual size_t dispatchBYE (const std::string &)
 A plugin point for posting of BYE messages. More...
 
- 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. More...
 
virtual ~MembershipBookkeeping ()
 Purges all RTPSource structures created during the session, as well as the hash table and the list of sources. More...
 
SyncSourceLinkgetLink (const SyncSource &source) const
 
bool isMine (const SyncSource &source) const
 Get whether a synchronization source is recorded in this membership controller. More...
 
bool isRegistered (uint32 ssrc)
 Returns whether there is already a synchronizacion source with "ssrc" SSRC identifier. More...
 
SyncSourceLinkgetSourceBySSRC (uint32 ssrc, bool &created)
 Get the description of a source by its ssrc identifier. More...
 
bool BYESource (uint32 ssrc)
 Mark the source identified by ssrc as having sent a BYE packet. More...
 
bool removeSource (uint32 ssrc)
 Remove the description of the source identified by ssrc More...
 
SyncSourceLinkgetFirst ()
 
SyncSourceLinkgetLast ()
 
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 requires SyncSource - SyncSourceHandler friendship. More...
 
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 ()
 
ConflictingTransportAddresssearchDataConflict (InetAddress na, tpport_t dtp)
 
ConflictingTransportAddresssearchControlConflict (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)
 This is used to write the RTP data packet to one or more destinations. More...
 
microtimeout_t getSchedulingTimeout ()
 This computes the timeout period for scheduling transmission of the next packet at the "head" of the send buffer. More...
 
size_t dispatchDataPacket ()
 This function is used by the service thread to process the next outgoing packet pending in the sending queue. More...
 
void setNextSeqNum (uint32 seqNum)
 For thoses cases in which the application requires a method to set the sequence number for the outgoing stream (such as for implementing the RTSP PLAY command). More...
 
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 () const
 
bool addDestinationToList (const InetAddress &ia, tpport_t data, tpport_t control)
 Locks the object before modifying it. More...
 
bool removeDestinationFromList (const InetAddress &ia, tpport_t dataPort, tpport_t controlPort)
 Locks the object before modifying it. More...
 
 DestinationListHandler ()
 
 ~DestinationListHandler ()
 
bool isSingleDestination () const
 Get whether there is only a destination in the list. More...
 
TransportAddressgetFirstDestination () const
 
void lockDestinationList () const
 
void unlockDestinationList () const
 

Additional Inherited Members

- Public Types inherited from RTPDataQueue
enum  Tos { tosBestEffort, tosEnhanced }
 rtp.h cc++/rtp.h More...
 
- Static Public Member Functions inherited from IncomingDataQueue
static size_t getDefaultMembersSize ()
 
- Protected Attributes inherited from IncomingDataQueue
ThreadLock recvLock
 
IncomingRTPPktLink * recvFirst
 
IncomingRTPPktLink * recvLast
 
uint8 minValidPacketSequence
 
uint16 maxPacketMisorder
 
uint16 maxPacketDropout
 
uint8 sourceExpirationPeriod
 
Mutex cryptoMutex
 
std::list< CryptoContext * > cryptoContexts
 
- Protected Attributes inherited from ConflictHandler
ConflictingTransportAddressfirstConflict
 
ConflictingTransportAddresslastConflict
 
- Protected Attributes inherited from OutgoingDataQueue
Mutex cryptoMutex
 
std::list< CryptoContext * > cryptoContexts
 
- Protected Attributes inherited from DestinationListHandler
std::list< TransportAddress * > destList
 
- Static Protected Attributes inherited from IncomingDataQueue
static const uint8 defaultMinValidPacketSequence
 
static const uint16 defaultMaxPacketMisorder
 
static const uint16 defaultMaxPacketDropout
 
static const size_t defaultMembersSize
 
- Static Protected Attributes inherited from MembershipBookkeeping
static const size_t defaultMembersHashSize
 
static 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.

Author
David Sugar RTP peer host over UDP.
Examples:
rtpduphello.cpp.

Constructor & Destructor Documentation

RTPDuplex::RTPDuplex ( const InetAddress &  bind,
tpport_t  local,
tpport_t  remote 
)
Parameters
bindnetwork address this socket is to be bound
localtransport port this socket is to be bound
remotepeer transpor port
virtual RTPDuplex::~RTPDuplex ( )
virtual

Member Function Documentation

UDPTransmit::Error RTPDuplex::connect ( const InetHostAddress &  host,
tpport_t  port = 0 
)
Parameters
hostpeer address
portpeer port. If not specified, the same as the local is used
Returns
socket status
Examples:
rtpduphello.cpp.
size_t RTPDuplex::getNextDataPacketSize ( ) const
inlineprotectedvirtual

Implements IncomingDataQueue.

SyncSource& RTPDuplex::getPeer ( )
protected
Returns
the associated peer information
bool RTPDuplex::isPendingData ( microtimeout_t  timeout)
inlineprotectedvirtual
Parameters
timeouthow much time to wait for new data
Returns
if there is some new data

Implements RTPDataQueue.

size_t RTPDuplex::recvData ( unsigned char *  buffer,
size_t  len,
InetHostAddress &  na,
tpport_t &  tp 
)
inlineprotectedvirtual
Parameters
bufferwhere to store the retrieved data
lenhow many octets to read
naSource network address.
tpSource transport port.
Returns
number of octets read

Implements IncomingDataQueue.

size_t RTPDuplex::sendData ( const unsigned char *const  buffer,
size_t  len 
)
inlineprotectedvirtual
Parameters
bufferpointer to data to be written
lenhow many octets to write
Returns
number of octets written

Reimplemented from OutgoingDataQueue.

void RTPDuplex::setControlPeer ( const InetAddress &  ,
tpport_t   
)
inlineprotectedvirtual
Parameters
-peer host network address.
-peer host RTCP transport port.

Reimplemented from OutgoingDataQueue.

void RTPDuplex::setDataPeer ( const InetAddress &  ,
tpport_t   
)
inlineprotectedvirtual
Parameters
-peer host network address.
-peer host RTP data transport port.

Reimplemented from OutgoingDataQueue.


The documentation for this class was generated from the following file: