JRTPLIB  3.9.0
Public Types | Public Member Functions | Protected Member Functions | List of all members
jrtplib::RTPSources Class Reference

Represents a table in which information about the participating sources is kept. More...

#include <rtpsources.h>

Inherits jrtplib::RTPMemoryObject.

Inherited by jrtplib::RTPSessionSources.

Public Types

enum  ProbationType { NoProbation, ProbationDiscard, ProbationStore }
 Type of probation to use for new sources. More...
 

Public Member Functions

 RTPSources (ProbationType=ProbationStore, RTPMemoryManager *mgr=0)
 In the constructor you can select the probation type you'd like to use and also a memory manager. More...
 
void Clear ()
 Clears the source table. More...
 
void SetProbationType (ProbationType probtype)
 Changes the current probation type. More...
 
int CreateOwnSSRC (uint32_t ssrc)
 Creates an entry for our own SSRC identifier. More...
 
int DeleteOwnSSRC ()
 Deletes the entry for our own SSRC identifier. More...
 
void SentRTPPacket ()
 This function should be called if our own session has sent an RTP packet. More...
 
int ProcessRawPacket (RTPRawPacket *rawpack, RTPTransmitter *trans, bool acceptownpackets)
 Processes a raw packet rawpack. More...
 
int ProcessRawPacket (RTPRawPacket *rawpack, RTPTransmitter *trans[], int numtrans, bool acceptownpackets)
 Processes a raw packet rawpack. More...
 
int ProcessRTPPacket (RTPPacket *rtppack, const RTPTime &receivetime, const RTPAddress *senderaddress, bool *stored)
 Processes an RTPPacket instance rtppack which was received at time receivetime and which originated from senderaddres. More...
 
int ProcessRTCPCompoundPacket (RTCPCompoundPacket *rtcpcomppack, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Processes the RTCP compound packet rtcpcomppack which was received at time receivetime from senderaddress. More...
 
int ProcessRTCPSenderInfo (uint32_t ssrc, const RTPNTPTime &ntptime, uint32_t rtptime, uint32_t packetcount, uint32_t octetcount, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Process the sender information of SSRC ssrc into the source table. More...
 
int ProcessRTCPReportBlock (uint32_t ssrc, uint8_t fractionlost, int32_t lostpackets, uint32_t exthighseqnr, uint32_t jitter, uint32_t lsr, uint32_t dlsr, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Processes the report block information which was sent by participant ssrc into the source table. More...
 
int ProcessSDESNormalItem (uint32_t ssrc, RTCPSDESPacket::ItemType t, size_t itemlength, const void *itemdata, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Processes the non-private SDES item from source ssrc into the source table. More...
 
int ProcessSDESPrivateItem (uint32_t ssrc, size_t prefixlen, const void *prefixdata, size_t valuelen, const void *valuedata, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Processes the SDES private item from source ssrc into the source table. More...
 
int ProcessBYE (uint32_t ssrc, size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Processes the BYE message for SSRC ssrc. More...
 
int UpdateReceiveTime (uint32_t ssrc, const RTPTime &receivetime, const RTPAddress *senderaddress)
 If we heard from source ssrc, but no actual data was added to the source table (for example, if no report block was meant for us), this function can e used to indicate that something was received from this source. More...
 
bool GotoFirstSource ()
 Starts the iteration over the participants by going to the first member in the table. More...
 
bool GotoNextSource ()
 Sets the current source to be the next source in the table. More...
 
bool GotoPreviousSource ()
 Sets the current source to be the previous source in the table. More...
 
bool GotoFirstSourceWithData ()
 Sets the current source to be the first source in the table which has RTPPacket instances that we haven't extracted yet. More...
 
bool GotoNextSourceWithData ()
 Sets the current source to be the next source in the table which has RTPPacket instances that we haven't extracted yet. More...
 
bool GotoPreviousSourceWithData ()
 Sets the current source to be the previous source in the table which has RTPPacket instances that we haven't extracted yet. More...
 
RTPSourceDataGetCurrentSourceInfo ()
 Returns the RTPSourceData instance for the currently selected participant. More...
 
RTPSourceDataGetSourceInfo (uint32_t ssrc)
 Returns the RTPSourceData instance for the participant identified by ssrc, or NULL if no such entry exists.
 
RTPPacketGetNextPacket ()
 Extracts the next packet from the received packets queue of the current participant. More...
 
bool GotEntry (uint32_t ssrc)
 Returns true if an entry for participant ssrc exists and false otherwise. More...
 
RTPSourceDataGetOwnSourceInfo ()
 If present, it returns the RTPSourceData instance of the entry which was created by CreateOwnSSRC. More...
 
void Timeout (const RTPTime &curtime, const RTPTime &timeoutdelay)
 Assuming that the current time is curtime, time out the members from whom we haven't heard during the previous time interval timeoutdelay.
 
void SenderTimeout (const RTPTime &curtime, const RTPTime &timeoutdelay)
 Assuming that the current time is curtime, remove the sender flag for senders from whom we haven't received any RTP packets during the previous time interval timeoutdelay.
 
void BYETimeout (const RTPTime &curtime, const RTPTime &timeoutdelay)
 Assuming that the current time is curtime, remove the members who sent a BYE packet more than the time interval timeoutdelay ago.
 
void NoteTimeout (const RTPTime &curtime, const RTPTime &timeoutdelay)
 Assuming that the current time is curtime, clear the SDES NOTE items which haven't been updated during the previous time interval timeoutdelay.
 
void MultipleTimeouts (const RTPTime &curtime, const RTPTime &sendertimeout, const RTPTime &byetimeout, const RTPTime &generaltimeout, const RTPTime &notetimeout)
 Combines the functions SenderTimeout, BYETimeout, Timeout and NoteTimeout. More...
 
int GetSenderCount () const
 Returns the number of participants which are marked as a sender. More...
 
int GetTotalCount () const
 Returns the total number of entries in the source table. More...
 
int GetActiveMemberCount () const
 Returns the number of members which have been validated and which haven't sent a BYE packet yet. More...
 

Protected Member Functions

virtual void OnRTPPacket (RTPPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Is called when an RTP packet is about to be processed. More...
 
virtual void OnRTCPCompoundPacket (RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Is called when an RTCP compound packet is about to be processed. More...
 
virtual void OnSSRCCollision (RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp)
 Is called when an SSRC collision was detected. More...
 
virtual void OnCNAMECollision (RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, size_t cnamelength)
 Is called when another CNAME was received than the one already present for source srcdat. More...
 
virtual void OnNewSource (RTPSourceData *srcdat)
 Is called when a new entry srcdat is added to the source table. More...
 
virtual void OnRemoveSource (RTPSourceData *srcdat)
 Is called when the entry srcdat is about to be deleted from the source table. More...
 
virtual void OnTimeout (RTPSourceData *srcdat)
 Is called when participant srcdat is timed out. More...
 
virtual void OnBYETimeout (RTPSourceData *srcdat)
 Is called when participant srcdat is timed after having sent a BYE packet. More...
 
virtual void OnBYEPacket (RTPSourceData *srcdat)
 Is called when a BYE packet has been processed for source srcdat. More...
 
virtual void OnAPPPacket (RTCPAPPPacket *apppacket, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Is called when an RTCP APP packet apppacket has been received at time receivetime from address senderaddress.
 
virtual void OnUnknownPacketType (RTCPPacket *rtcppack, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Is called when an unknown RTCP packet type was detected. More...
 
virtual void OnUnknownPacketFormat (RTCPPacket *rtcppack, const RTPTime &receivetime, const RTPAddress *senderaddress)
 Is called when an unknown packet format for a known packet type was detected. More...
 
virtual void OnNoteTimeout (RTPSourceData *srcdat)
 Is called when the SDES NOTE item for source srcdat has been timed out. More...
 

Detailed Description

Represents a table in which information about the participating sources is kept. The class has member functions to process RTP and RTCP data and to iterate over the participants. Note that a NULL address is used to identify packets from our own session. The class also provides some overridable functions which can be used to catch certain events (new SSRC, SSRC collision, ...).

Member Enumeration Documentation

Enumerator
NoProbation 

Don't use the probation algorithm; accept RTP packets immediately.

ProbationDiscard 

Discard incoming RTP packets originating from a source that's on probation.

ProbationStore 

Store incoming RTP packet from a source that's on probation for later retrieval.

Constructor & Destructor Documentation

jrtplib::RTPSources::RTPSources ( ProbationType  = ProbationStore,
RTPMemoryManager mgr = 0 
)

Member Function Documentation

void jrtplib::RTPSources::Clear ( )
int jrtplib::RTPSources::CreateOwnSSRC ( uint32_t  ssrc)
int jrtplib::RTPSources::DeleteOwnSSRC ( )
int jrtplib::RTPSources::GetActiveMemberCount ( ) const
inline
RTPSourceData* jrtplib::RTPSources::GetCurrentSourceInfo ( )
RTPPacket* jrtplib::RTPSources::GetNextPacket ( )
RTPSourceData* jrtplib::RTPSources::GetOwnSourceInfo ( )
inline
int jrtplib::RTPSources::GetSenderCount ( ) const
inline
int jrtplib::RTPSources::GetTotalCount ( ) const
inline
bool jrtplib::RTPSources::GotEntry ( uint32_t  ssrc)
bool jrtplib::RTPSources::GotoFirstSource ( )

Starts the iteration over the participants by going to the first member in the table. If a member was found, the function returns true, otherwise it returns false.

bool jrtplib::RTPSources::GotoFirstSourceWithData ( )

Sets the current source to be the first source in the table which has RTPPacket instances that we haven't extracted yet. If no such member was found, the function returns false, otherwise it returns true.

bool jrtplib::RTPSources::GotoNextSource ( )

Sets the current source to be the next source in the table. If we're already at the last source, the function returns false, otherwise it returns true.

bool jrtplib::RTPSources::GotoNextSourceWithData ( )

Sets the current source to be the next source in the table which has RTPPacket instances that we haven't extracted yet. If no such member was found, the function returns false, otherwise it returns true.

bool jrtplib::RTPSources::GotoPreviousSource ( )

Sets the current source to be the previous source in the table. If we're at the first source, the function returns false, otherwise it returns true.

bool jrtplib::RTPSources::GotoPreviousSourceWithData ( )

Sets the current source to be the previous source in the table which has RTPPacket instances that we haven't extracted yet. If no such member was found, the function returns false, otherwise it returns true.

void jrtplib::RTPSources::MultipleTimeouts ( const RTPTime curtime,
const RTPTime sendertimeout,
const RTPTime byetimeout,
const RTPTime generaltimeout,
const RTPTime notetimeout 
)

Combines the functions SenderTimeout, BYETimeout, Timeout and NoteTimeout. This is more efficient than calling all four functions since only one iteration is needed in this function.

virtual void jrtplib::RTPSources::OnBYEPacket ( RTPSourceData srcdat)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnBYETimeout ( RTPSourceData srcdat)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnCNAMECollision ( RTPSourceData srcdat,
const RTPAddress senderaddress,
const uint8_t *  cname,
size_t  cnamelength 
)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnNewSource ( RTPSourceData srcdat)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnNoteTimeout ( RTPSourceData srcdat)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnRemoveSource ( RTPSourceData srcdat)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnRTCPCompoundPacket ( RTCPCompoundPacket pack,
const RTPTime receivetime,
const RTPAddress senderaddress 
)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnRTPPacket ( RTPPacket pack,
const RTPTime receivetime,
const RTPAddress senderaddress 
)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnSSRCCollision ( RTPSourceData srcdat,
const RTPAddress senderaddress,
bool  isrtp 
)
inlineprotectedvirtual

Is called when an SSRC collision was detected. The instance srcdat is the one present in the table, the address senderaddress is the one that collided with one of the addresses and isrtp indicates against which address of srcdat the check failed.

virtual void jrtplib::RTPSources::OnTimeout ( RTPSourceData srcdat)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnUnknownPacketFormat ( RTCPPacket rtcppack,
const RTPTime receivetime,
const RTPAddress senderaddress 
)
inlineprotectedvirtual
virtual void jrtplib::RTPSources::OnUnknownPacketType ( RTCPPacket rtcppack,
const RTPTime receivetime,
const RTPAddress senderaddress 
)
inlineprotectedvirtual
int jrtplib::RTPSources::ProcessBYE ( uint32_t  ssrc,
size_t  reasonlength,
const void *  reasondata,
const RTPTime receivetime,
const RTPAddress senderaddress 
)

Processes the BYE message for SSRC ssrc. The information was received at time receivetime from address senderaddress. The senderaddress parameter must be NULL if the packet was sent by the local participant.

int jrtplib::RTPSources::ProcessRawPacket ( RTPRawPacket rawpack,
RTPTransmitter trans,
bool  acceptownpackets 
)

Processes a raw packet rawpack. The instance trans will be used to check if this packet is one of our own packets. The flag acceptownpackets indicates whether own packets should be accepted or ignored.

int jrtplib::RTPSources::ProcessRawPacket ( RTPRawPacket rawpack,
RTPTransmitter trans[],
int  numtrans,
bool  acceptownpackets 
)

Processes a raw packet rawpack. Every transmitter in the array trans of length numtrans is used to check if the packet is from our own session. The flag acceptownpackets indicates whether own packets should be accepted or ignored.

int jrtplib::RTPSources::ProcessRTCPCompoundPacket ( RTCPCompoundPacket rtcpcomppack,
const RTPTime receivetime,
const RTPAddress senderaddress 
)

Processes the RTCP compound packet rtcpcomppack which was received at time receivetime from senderaddress. The senderaddress parameter must be NULL if the packet was sent by the local participant.

int jrtplib::RTPSources::ProcessRTCPReportBlock ( uint32_t  ssrc,
uint8_t  fractionlost,
int32_t  lostpackets,
uint32_t  exthighseqnr,
uint32_t  jitter,
uint32_t  lsr,
uint32_t  dlsr,
const RTPTime receivetime,
const RTPAddress senderaddress 
)

Processes the report block information which was sent by participant ssrc into the source table. The information was received at time receivetime from address senderaddress The senderaddress parameter must be NULL if the packet was sent by the local participant.

int jrtplib::RTPSources::ProcessRTCPSenderInfo ( uint32_t  ssrc,
const RTPNTPTime ntptime,
uint32_t  rtptime,
uint32_t  packetcount,
uint32_t  octetcount,
const RTPTime receivetime,
const RTPAddress senderaddress 
)

Process the sender information of SSRC ssrc into the source table. The information was received at time receivetime from address senderaddress. The senderaddress} parameter must be NULL if the packet was sent by the local participant.

int jrtplib::RTPSources::ProcessRTPPacket ( RTPPacket rtppack,
const RTPTime receivetime,
const RTPAddress senderaddress,
bool *  stored 
)

Processes an RTPPacket instance rtppack which was received at time receivetime and which originated from senderaddres. The senderaddress parameter must be NULL if the packet was sent by the local participant. The flag stored indicates whether the packet was stored in the table or not. If so, the rtppack instance may not be deleted.

int jrtplib::RTPSources::ProcessSDESNormalItem ( uint32_t  ssrc,
RTCPSDESPacket::ItemType  t,
size_t  itemlength,
const void *  itemdata,
const RTPTime receivetime,
const RTPAddress senderaddress 
)

Processes the non-private SDES item from source ssrc into the source table. The information was received at time receivetime from address senderaddress. The senderaddress parameter must be NULL if the packet was sent by the local participant.

int jrtplib::RTPSources::ProcessSDESPrivateItem ( uint32_t  ssrc,
size_t  prefixlen,
const void *  prefixdata,
size_t  valuelen,
const void *  valuedata,
const RTPTime receivetime,
const RTPAddress senderaddress 
)

Processes the SDES private item from source ssrc into the source table. The information was received at time receivetime from address senderaddress. The senderaddress parameter must be NULL if the packet was sent by the local participant.

void jrtplib::RTPSources::SentRTPPacket ( )

This function should be called if our own session has sent an RTP packet. For our own SSRC entry, the sender flag is updated based upon outgoing packets instead of incoming packets.

void jrtplib::RTPSources::SetProbationType ( ProbationType  probtype)
inline
int jrtplib::RTPSources::UpdateReceiveTime ( uint32_t  ssrc,
const RTPTime receivetime,
const RTPAddress senderaddress 
)

If we heard from source ssrc, but no actual data was added to the source table (for example, if no report block was meant for us), this function can e used to indicate that something was received from this source. This will prevent a premature timeout for this participant. The message was received at time receivetime from address senderaddress. The senderaddress parameter must be NULL if the packet was sent by the local participant.


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