41 #include "rtpconfig.h"
47 #define RTPSOURCES_HASHSIZE 8317
52 class JRTPLIB_IMPORTEXPORT RTPSources_GetHashIndex
55 static int GetIndex(
const uint32_t &ssrc) {
return ssrc%RTPSOURCES_HASHSIZE; }
61 class RTPInternalSourceData;
74 class JRTPLIB_IMPORTEXPORT
RTPSources :
public RTPMemoryObject
92 #ifdef RTP_SUPPORT_PROBATION
145 uint32_t packetcount,uint32_t octetcount,
const RTPTime &receivetime,
154 uint32_t exthighseqnr,uint32_t jitter,uint32_t lsr,
163 const void *itemdata,
const RTPTime &receivetime,
const RTPAddress *senderaddress);
164 #ifdef RTP_SUPPORT_SDESPRIV
171 size_t valuelen,
const void *valuedata,
const RTPTime &receivetime,
179 int ProcessBYE(uint32_t ssrc,size_t reasonlength,const void *reasondata,const RTPTime &receivetime,
290 void SafeCountTotal();
291 void SafeCountSenders();
292 void SafeCountActive();
311 const uint8_t *cname,
size_t cnamelength);
336 const void *itemdata,
size_t itemlength);
337 #ifdef RTP_SUPPORT_SDESPRIV
339 virtual void OnRTCPSDESPrivateItem(
RTPSourceData *srcdat,
const void *prefixdata,
size_t prefixlen,
340 const void *valuedata,
size_t valuelen);
351 virtual void OnUnknownPacketType(
RTCPPacket *rtcppack,
const RTPTime &receivetime,
355 virtual void OnUnknownPacketFormat(
RTCPPacket *rtcppack,
const RTPTime &receivetime,
365 virtual void OnValidatedRTPPacket(
RTPSourceData *srcdat,
RTPPacket *rtppack,
bool isonprobation,
bool *ispackethandled);
367 void ClearSourceList();
368 int ObtainSourceDataInstance(uint32_t ssrc,RTPInternalSourceData **srcdat,
bool *created);
369 int GetRTCPSourceData(uint32_t ssrc,
const RTPAddress *senderaddress,RTPInternalSourceData **srcdat,
bool *newsource);
370 bool CheckCollision(RTPInternalSourceData *srcdat,
const RTPAddress *senderaddress,
bool isrtp);
372 RTPKeyHashTable<const uint32_t,RTPInternalSourceData*,RTPSources_GetHashIndex,RTPSOURCES_HASHSIZE> sourcelist;
378 #ifdef RTP_SUPPORT_PROBATION
379 ProbationType probationtype;
382 RTPInternalSourceData *owndata;
384 friend class RTPInternalSourceData;
400 #ifdef RTP_SUPPORT_SDESPRIV
Describes an RTCP APP packet.
Definition: rtcpapppacket.h:55
Represents an RTCP compound packet.
Definition: rtcpcompoundpacket.h:54
Base class for specific types of RTCP packets.
Definition: rtcppacket.h:51
ItemType
Identifies the type of an SDES item.
Definition: rtcpsdespacket.h:60
This class is an abstract class which is used to specify destinations, multicast groups etc.
Definition: rtpaddress.h:51
A memory manager.
Definition: rtpmemorymanager.h:151
This is a simple wrapper for the most significant word (MSW) and least significant word (LSW) of an N...
Definition: rtptimeutilities.h:67
Represents an RTP Packet.
Definition: rtppacket.h:57
This class is used by the transmission component to store the incoming RTP and RTCP data in.
Definition: rtprawpacket.h:53
Describes an entry in the RTPSources source table.
Definition: rtpsourcedata.h:167
Represents a table in which information about the participating sources is kept.
Definition: rtpsources.h:75
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.
void SentRTPPacket()
This function should be called if our own session has sent an RTP packet.
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 durin...
virtual void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled)
Allows you to use an RTP packet from the specified source directly.
Definition: rtpsources.h:407
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.
virtual void OnRTCPSenderReport(RTPSourceData *srcdat)
Is called when an RTCP sender report has been processed for this source.
Definition: rtpsources.h:397
void Clear()
Clears the source table.
int ProcessRTCPCompoundPacket(RTCPCompoundPacket *rtcpcomppack, const RTPTime &receivetime, const RTPAddress *senderaddress)
Processes the RTCP compound packet rtcpcomppack which was received at time receivetime from senderadd...
ProbationType
Type of probation to use for new sources.
Definition: rtpsources.h:80
@ NoProbation
Don't use the probation algorithm; accept RTP packets immediately.
Definition: rtpsources.h:81
@ ProbationDiscard
Discard incoming RTP packets originating from a source that's on probation.
Definition: rtpsources.h:82
bool GotoPreviousSourceWithData()
Sets the current source to be the previous source in the table which has RTPPacket instances that we ...
bool GotoPreviousSource()
Sets the current source to be the previous source in the table.
int GetSenderCount() const
Returns the number of participants which are marked as a sender.
Definition: rtpsources.h:281
virtual void OnNewSource(RTPSourceData *srcdat)
Is called when a new entry srcdat is added to the source table.
Definition: rtpsources.h:392
int GetTotalCount() const
Returns the total number of entries in the source table.
Definition: rtpsources.h:284
RTPSourceData * GetCurrentSourceInfo()
Returns the RTPSourceData instance for the currently selected participant.
int DeleteOwnSSRC()
Deletes the entry for our own SSRC identifier.
int ProcessRawPacket(RTPRawPacket *rawpack, RTPTransmitter *trans, bool acceptownpackets)
Processes a raw packet rawpack.
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 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 f...
bool GotoFirstSourceWithData()
Sets the current source to be the first source in the table which has RTPPacket instances that we hav...
int ProcessRawPacket(RTPRawPacket *rawpack, RTPTransmitter *trans[], int numtrans, bool acceptownpackets)
Processes a raw packet rawpack.
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 sender...
Definition: rtpsources.h:403
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 re...
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,...
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.
virtual void OnUnknownPacketType(RTCPPacket *rtcppack, const RTPTime &receivetime, const RTPAddress *senderaddress)
Is called when an unknown RTCP packet type was detected.
Definition: rtpsources.h:404
virtual void OnNoteTimeout(RTPSourceData *srcdat)
Is called when the SDES NOTE item for source srcdat has been timed out.
Definition: rtpsources.h:406
virtual void OnTimeout(RTPSourceData *srcdat)
Is called when participant srcdat is timed out.
Definition: rtpsources.h:394
virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, const void *valuedata, size_t valuelen)
Is called when a specific SDES item of 'private' type was received for this source.
Definition: rtpsources.h:401
void SetProbationType(ProbationType probtype)
Changes the current probation type.
Definition: rtpsources.h:94
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 tim...
int CreateOwnSSRC(uint32_t ssrc)
Creates an entry for our own SSRC identifier.
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.
bool GotEntry(uint32_t ssrc)
Returns true if an entry for participant ssrc exists and false otherwise.
bool GotoFirstSource()
Starts the iteration over the participants by going to the first member in the table.
virtual void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp)
Is called when an SSRC collision was detected.
Definition: rtpsources.h:390
virtual void OnBYETimeout(RTPSourceData *srcdat)
Is called when participant srcdat is timed after having sent a BYE packet.
Definition: rtpsources.h:395
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.
Definition: rtpsources.h:391
virtual void OnRemoveSource(RTPSourceData *srcdat)
Is called when the entry srcdat is about to be deleted from the source table.
Definition: rtpsources.h:393
virtual void OnRTCPReceiverReport(RTPSourceData *srcdat)
Is called when an RTCP receiver report has been processed for this source.
Definition: rtpsources.h:398
RTPSourceData * GetSourceInfo(uint32_t ssrc)
Returns the RTPSourceData instance for the participant identified by ssrc, or NULL if no such entry e...
int GetActiveMemberCount() const
Returns the number of members which have been validated and which haven't sent a BYE packet yet.
Definition: rtpsources.h:287
bool GotoNextSource()
Sets the current source to be the next source in the table.
virtual void OnRTPPacket(RTPPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
Is called when an RTP packet is about to be processed.
Definition: rtpsources.h:388
virtual void OnBYEPacket(RTPSourceData *srcdat)
Is called when a BYE packet has been processed for source srcdat.
Definition: rtpsources.h:396
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.
Definition: rtpsources.h:405
virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, size_t itemlength)
Is called when a specific SDES item was received for this source.
Definition: rtpsources.h:399
RTPSourceData * GetOwnSourceInfo()
If present, it returns the RTPSourceData instance of the entry which was created by CreateOwnSSRC.
Definition: rtpsources.h:250
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.
RTPPacket * GetNextPacket()
Extracts the next packet from the received packets queue of the current participant.
bool GotoNextSourceWithData()
Sets the current source to be the next source in the table which has RTPPacket instances that we have...
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...
virtual void OnRTCPCompoundPacket(RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
Is called when an RTCP compound packet is about to be processed.
Definition: rtpsources.h:389
This class is used to specify wallclock time, delay intervals etc.
Definition: rtptimeutilities.h:86
Abstract class from which actual transmission components should be derived.
Definition: rtptransmitter.h:63