#include <rtpsources.h>
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. | |
void | Clear () |
Clears the source table. | |
void | SetProbationType (ProbationType probtype) |
Changes the current probation type. | |
int | CreateOwnSSRC (uint32_t ssrc) |
Creates an entry for our own SSRC identifier. | |
int | DeleteOwnSSRC () |
Deletes the entry for our own SSRC identifier. | |
void | SentRTPPacket () |
This function should be called if our own session has sent an RTP packet. | |
int | ProcessRawPacket (RTPRawPacket *rawpack, RTPTransmitter *trans, bool acceptownpackets) |
Processes a raw packet rawpack . | |
int | ProcessRawPacket (RTPRawPacket *rawpack, RTPTransmitter *trans[], int numtrans, bool acceptownpackets) |
Processes a raw packet rawpack . | |
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 . | |
int | ProcessRTCPCompoundPacket (RTCPCompoundPacket *rtcpcomppack, const RTPTime &receivetime, const RTPAddress *senderaddress) |
Processes the RTCP compound packet rtcpcomppack which was received at time receivetime from senderaddress . | |
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. | |
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. | |
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. | |
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. | |
int | ProcessBYE (uint32_t ssrc, size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress) |
Processes the BYE message for SSRC ssrc . | |
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. | |
bool | GotoFirstSource () |
Starts the iteration over the participants by going to the first member in the table. | |
bool | GotoNextSource () |
Sets the current source to be the next source in the table. | |
bool | GotoPreviousSource () |
Sets the current source to be the previous source in the table. | |
bool | GotoFirstSourceWithData () |
Sets the current source to be the first source in the table which has RTPPacket instances that we haven't extracted yet. | |
bool | GotoNextSourceWithData () |
Sets the current source to be the next source in the table which has RTPPacket instances that we haven't extracted yet. | |
bool | GotoPreviousSourceWithData () |
Sets the current source to be the previous source in the table which has RTPPacket instances that we haven't extracted yet. | |
RTPSourceData * | GetCurrentSourceInfo () |
Returns the RTPSourceData instance for the currently selected participant. | |
RTPSourceData * | GetSourceInfo (uint32_t ssrc) |
Returns the RTPSourceData instance for the participant identified by ssrc , or NULL if no such entry exists. | |
RTPPacket * | GetNextPacket () |
Extracts the next packet from the received packets queue of the current participant. | |
bool | GotEntry (uint32_t ssrc) |
Returns true if an entry for participant ssrc exists and false otherwise. | |
RTPSourceData * | GetOwnSourceInfo () |
If present, it returns the RTPSourceData instance of the entry which was created by CreateOwnSSRC. | |
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 ¬etimeout) |
Combines the functions SenderTimeout, BYETimeout, Timeout and NoteTimeout. | |
int | GetSenderCount () const |
Returns the number of participants which are marked as a sender. | |
int | GetTotalCount () const |
Returns the total number of entries in the source table. | |
int | GetActiveMemberCount () const |
Returns the number of members which have been validated and which haven't sent a BYE packet yet. | |
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. | |
virtual void | OnRTCPCompoundPacket (RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress) |
Is called when an RTCP compound packet is about to be processed. | |
virtual void | OnSSRCCollision (RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp) |
Is called when an SSRC collision was detected. | |
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 . | |
virtual void | OnNewSource (RTPSourceData *srcdat) |
Is called when a new entry srcdat is added to the source table. | |
virtual void | OnRemoveSource (RTPSourceData *srcdat) |
Is called when the entry srcdat is about to be deleted from the source table. | |
virtual void | OnTimeout (RTPSourceData *srcdat) |
Is called when participant srcdat is timed out. | |
virtual void | OnBYETimeout (RTPSourceData *srcdat) |
Is called when participant srcdat is timed after having sent a BYE packet. | |
virtual void | OnBYEPacket (RTPSourceData *srcdat) |
Is called when a BYE packet has been processed for source srcdat . | |
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. | |
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. | |
virtual void | OnNoteTimeout (RTPSourceData *srcdat) |
Is called when the SDES NOTE item for source srcdat has been timed out. |
void 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.
int 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 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 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 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 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 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 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 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.
int 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 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.
bool 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 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 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 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 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 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 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 RTPSources::OnSSRCCollision | ( | RTPSourceData * | srcdat, | |
const RTPAddress * | senderaddress, | |||
bool | isrtp | |||
) | [inline, protected, virtual] |
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.