SYNOPSIS

#include <iqueue.h>

Inherits IncomingDataQueueBase, and MembershipBookkeeping.

Inherited by RTPDataQueue.

Classes

class SyncSourcesIterator

iterator through the list of synchronizations sources in this session

Public Member Functions

SyncSourcesIterator begin ()

SyncSourcesIterator end ()

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. bool isWaiting (const SyncSource *src=NULL) const

Determine if packets are waiting in the reception queue. 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. 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. 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. uint16 getDefaultMaxPacketDropout () const

uint16 getMaxPacketDropout () const

void 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.

Static Public Member Functions

static size_t getDefaultMembersSize ()

Protected Member Functions

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. 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. 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. 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. 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. 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. virtual size_t getNextDataPacketSize () const =0

Protected Attributes

ThreadLock recvLock

IncomingRTPPktLink * recvFirst

IncomingRTPPktLink * recvLast

uint8 minValidPacketSequence

uint16 maxPacketMisorder

uint16 maxPacketDropout

uint8 sourceExpirationPeriod

Mutex cryptoMutex

std::list< CryptoContext * > cryptoContexts

Static Protected Attributes

static const uint8 defaultMinValidPacketSequence

static const uint16 defaultMaxPacketMisorder

static const uint16 defaultMaxPacketDropout

static const size_t defaultMembersSize

Detailed Description

Queue for incoming RTP data packets in an RTP session.

Author:

Federico Montesino Pouzols [email protected]

Constructor & Destructor Documentation

IncomingDataQueue::IncomingDataQueue (uint32size)\fC [protected]\fP

Parameters:

size initial size of the membership table.

virtual IncomingDataQueue::~IncomingDataQueue ()\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP

Member Function Documentation

\fBSyncSourcesIterator\fP IncomingDataQueue::begin ()\fC [inline]\fP

bool IncomingDataQueue::checkSSRCInIncomingRTPPkt (\fBSyncSourceLink\fP &sourceLink, boolis_new, InetAddress &na, tpport_ttp)\fC [protected]\fP

Apply collision and loop detection and correction algorithm when receiving RTP data packets. Follows section 8.2 in draft-ietf-avt-rtp-new.

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.

\fBSyncSourcesIterator\fP IncomingDataQueue::end ()\fC [inline]\fP

virtual bool IncomingDataQueue::end2EndDelayed (IncomingRTPPktLink &)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP

const \fBAppDataUnit\fP* IncomingDataQueue::getData (uint32stamp, const \fBSyncSource\fP *src = \fCNULL\fP)

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.

uint16 IncomingDataQueue::getDefaultMaxPacketDropout () const\fC [inline]\fP

uint16 IncomingDataQueue::getDefaultMaxPacketMisorder () const\fC [inline]\fP

static size_t IncomingDataQueue::getDefaultMembersSize ()\fC [inline]\fP, \fC [static]\fP

uint8 IncomingDataQueue::getDefaultMinValidPacketSequence () const\fC [inline]\fP

uint32 IncomingDataQueue::getFirstTimestamp (const \fBSyncSource\fP *src = \fCNULL\fP) const

Get timestamp of first packet waiting in the queue.

Parameters:

src optional source selector.

Returns:

timestamp of first arrival packet.

\fBCryptoContext\fP* IncomingDataQueue::getInQueueCryptoContext (uint32ssrc)

Get an input queue CryptoContext identified by SSRC.

Parameters:

ssrc Request CryptoContext for this incoming SSRC

Returns:

Pointer to CryptoContext of the SSRC of NULL if no context available for this SSRC.

uint16 IncomingDataQueue::getMaxPacketDropout () const\fC [inline]\fP

uint16 IncomingDataQueue::getMaxPacketMisorder () const\fC [inline]\fP

uint8 IncomingDataQueue::getMinValidPacketSequence () const\fC [inline]\fP

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\fC [protected]\fP, \fC [pure virtual]\fP

Implemented in RTPDuplex.

\fBIncomingDataQueue::IncomingRTPPktLink\fP* IncomingDataQueue::getWaiting (uint32timestamp, const \fBSyncSource\fP *src = \fCNULL\fP)\fC [protected]\fP

This is used to fetch a packet in the receive queue and to expire packets older than the current timestamp.

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)\fC [protected]\fP

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.

Parameters:

packetLink link to a packet just received and generally validated and processed by onRTPPacketRecv.

Returns:

whether the packet was successfully inserted.

Return values:

false when the packet is duplicated (there is already a packet from the same source with the same timestamp).

true when the packet is not duplicated.

bool IncomingDataQueue::isWaiting (const \fBSyncSource\fP *src = \fCNULL\fP) const

Determine if packets are waiting in the reception queue.

Parameters:

src Optional synchronization source selector.

Returns:

True if packets are waiting.

virtual void IncomingDataQueue::onExpireRecv (\fBIncomingRTPPkt\fP &)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP

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.

Parameters:

- packet expired from the recv queue.

virtual void IncomingDataQueue::onNewSyncSource (const \fBSyncSource\fP &)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP

Virtual called when a new synchronization source has joined the session.

Parameters:

- new synchronization source

virtual bool IncomingDataQueue::onRTPPacketRecv (\fBIncomingRTPPkt\fP &)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP

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.

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 (\fBIncomingRTPPkt\fP &pkt, int32errorCode)\fC [inline]\fP, \fC [protected]\fP, \fC [virtual]\fP

A hook that gets called if the decoding of an incoming SRTP was erroneous.

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 ()\fC [protected]\fP

void IncomingDataQueue::recordExtraction (const \fBIncomingRTPPkt\fP &pkt)\fC [protected]\fP

Log extraction of a packet from this source from the scheduled reception queue.

Parameters:

pkt Packet extracted from the queue.

bool IncomingDataQueue::recordReception (\fBSyncSourceLink\fP &srcLink, const \fBIncomingRTPPkt\fP &pkt, const timevalrecvtime)\fC [protected]\fP

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.

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_tlength, InetHostAddress &host, tpport_t &port)\fC [protected]\fP, \fC [pure virtual]\fP

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.

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.

void IncomingDataQueue::removeInQueueCryptoContext (\fBCryptoContext\fP *cc)

Remove input queue CryptoContext. The endQueue method (provided by RTPQueue) also deletes all registered CryptoContexts.

Parameters:

cc Pointer to initialized CryptoContext to remove. If pointer if NULL then delete the whole queue

void IncomingDataQueue::renewLocalSSRC ()\fC [protected]\fP, \fC [virtual]\fP

Reimplemented from RTPQueueBase.

void IncomingDataQueue::setInQueueCryptoContext (\fBCryptoContext\fP *cc)

Set input queue CryptoContext. The endQueue method (provided by RTPQueue) deletes all registered CryptoContexts.

Parameters:

cc Pointer to initialized CryptoContext.

void IncomingDataQueue::setMaxPacketDropout (uint16packets)\fC [inline]\fP

It also prevents packets sent after a restart of the source being immediately accepted.

void IncomingDataQueue::setMaxPacketMisorder (uint16packets)\fC [inline]\fP

void IncomingDataQueue::setMinValidPacketSequence (uint8packets)\fC [inline]\fP

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.

Note:

the default (see defaultMinValidPacketSequence()) value for this parameter is 0, 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 in onRTPPacketRecv().

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 (uint8intervals)\fC [inline]\fP, \fC [protected]\fP

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.

Parameters:

intervals number of RTCP report intervals

Note:

If RTCP is not being used, the RTCP interval is assumed to be the default: 5 seconds.

The default for this value is, as RECOMMENDED, 5.

virtual size_t IncomingDataQueue::takeInDataPacket ()\fC [protected]\fP, \fC [virtual]\fP

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.

Member Data Documentation

std::list<\fBCryptoContext\fP *> IncomingDataQueue::cryptoContexts\fC [protected]\fP

Mutex IncomingDataQueue::cryptoMutex\fC [mutable]\fP, \fC [protected]\fP

const uint16 IncomingDataQueue::defaultMaxPacketDropout\fC [static]\fP, \fC [protected]\fP

const uint16 IncomingDataQueue::defaultMaxPacketMisorder\fC [static]\fP, \fC [protected]\fP

const size_t IncomingDataQueue::defaultMembersSize\fC [static]\fP, \fC [protected]\fP

const uint8 IncomingDataQueue::defaultMinValidPacketSequence\fC [static]\fP, \fC [protected]\fP

uint16 IncomingDataQueue::maxPacketDropout\fC [protected]\fP

uint16 IncomingDataQueue::maxPacketMisorder\fC [protected]\fP

uint8 IncomingDataQueue::minValidPacketSequence\fC [protected]\fP

IncomingRTPPktLink* IncomingDataQueue::recvFirst\fC [protected]\fP

IncomingRTPPktLink * IncomingDataQueue::recvLast\fC [protected]\fP

ThreadLock IncomingDataQueue::recvLock\fC [mutable]\fP, \fC [protected]\fP

uint8 IncomingDataQueue::sourceExpirationPeriod\fC [protected]\fP

Author

Generated automatically by Doxygen for ccRTP from the source code.