44 #ifndef CCXX_RTP_IQUEUE_H_
45 #define CCXX_RTP_IQUEUE_H_
52 #ifdef CCXX_NAMESPACES
91 { activeSenders = n; }
103 {
return activeSenders; }
187 const std::string& val)
247 {
return networkAddress; }
250 {
return dataTransportPort; }
253 {
return controlTransportPort; }
283 { firstConflict = lastConflict = NULL; }
310 {
return defaultMembersHashSize; }
337 struct SyncSourceLink;
346 {
return getLink(source)->getMembership() ==
this; }
357 struct timeval& recv_ts,
366 srcPrev(sp), srcNext(sn),
367 receptionTime(recv_ts),
368 shiftedTimestamp(shifted_ts)
375 {
return sourceLink; }
378 { sourceLink = src; }
418 { receptionTime = t; }
424 {
return receptionTime; }
435 {
return shiftedTimestamp; }
438 { shiftedTimestamp = ts;}
449 struct timeval receptionTime;
484 membership(m), source(s), first(fp), last(lp),
485 prev(ps), next(ns), nextCollis(ncollis),
497 {
return membership; }
550 {
return nextCollis; }
556 {
return prevConflict; }
565 {
return senderInfo; }
567 void setSenderInfo(
unsigned char* si);
570 {
return receiverInfo; }
572 void setReceiverInfo(
unsigned char* ri);
575 {
return lastPacketTime; }
578 {
return lastRTCPPacketTime; }
581 {
return lastRTCPSRTime; }
588 {
return obsPacketCount; }
591 { obsPacketCount++; }
598 {
return obsOctetCount; }
601 { obsOctetCount += n; }
608 {
return maxSeqNum; }
620 {
return extendedMaxSeqNum; }
624 { extendedMaxSeqNum = seq; }
627 {
return cumulativePacketLost; }
630 { cumulativePacketLost = pl; }
633 {
return fractionLost; }
636 { fractionLost = fl; }
639 {
return lastPacketTransitTime; }
642 { lastPacketTransitTime = time; }
651 {
return initialDataTimestamp; }
654 { initialDataTimestamp = ts; }
657 {
return initialDataTime; }
660 { initialDataTime = it; }
691 {
return badSeqNum; }
697 {
return probation; }
706 {
return 0 == probation; }
709 {
return baseSeqNum; }
712 {
return seqNumAccum; }
715 { seqNumAccum += SEQNUMMOD; }
721 { maxSeqNum = seqNumAccum = seqnum; }
800 isRegistered(uint32 ssrc);
811 getSourceBySSRC(uint32 ssrc,
bool& created);
824 BYESource(uint32 ssrc);
834 removeSource(uint32 ssrc);
910 {
return *(link->getSource()); }
913 {
return link->getSource(); }
916 link = link->getNext();
954 getData(uint32 stamp,
const SyncSource* src = NULL);
964 isWaiting(
const SyncSource* src = NULL)
const;
973 getFirstTimestamp(
const SyncSource* src = NULL)
const;
999 { minValidPacketSequence = packets; }
1003 {
return defaultMinValidPacketSequence; }
1011 {
return minValidPacketSequence; }
1015 { maxPacketMisorder = packets; }
1019 {
return defaultMaxPacketMisorder; }
1023 {
return maxPacketMisorder; }
1032 { maxPacketDropout = packets; }
1036 {
return defaultMaxPacketDropout; }
1040 {
return maxPacketDropout; }
1044 inline static size_t
1046 {
return defaultMembersSize; }
1080 getInQueueCryptoContext(uint32 ssrc);
1103 bool checkSSRCInIncomingRTPPkt(SyncSourceLink& sourceLink,
1123 { sourceExpirationPeriod = intervals; }
1134 void renewLocalSSRC();
1146 getWaiting(uint32 timestamp,
const SyncSource *src = NULL);
1164 recordReception(SyncSourceLink& srcLink,
const IncomingRTPPkt& pkt,
1165 const timeval recvtime);
1176 void purgeIncomingQueue();
1257 insertRecvPacket(IncomingRTPPktLink* packetLink);
1271 recvData(
unsigned char* buffer,
size_t length,
1275 getNextDataPacketSize()
const = 0;
1295 #ifdef CCXX_NAMESPACES
1299 #endif //CCXX_RTP_IQUEUE_H_
void setFirst(IncomingRTPPktLink *fp)
virtual bool onRTPPacketRecv(IncomingRTPPkt &)
A virtual function to support parsing of arriving packets to determine if they should be kept in the ...
ConflictingTransportAddress * next
static const uint16 defaultMaxPacketDropout
void addParticipant(RTPApplication &app, Participant &part)
static const uint32 SEQNUMMOD
virtual ~ParticipantHandler()
void setSourceExpirationPeriod(uint8 intervals)
Set the number of RTCP intervals that the stack will wait to change the state of a source from stateA...
An RTP application, holding identifying RTCP SDES item values.
uint16 getBaseSeqNum() const
void setMembersCount(uint32 n)
std::forward_iterator_tag iterator_category
Synchronization source in an RTP session.
void incObservedPacketCount()
virtual ~MembershipBookkeeping()
Purges all RTPSource structures created during the session, as well as the hash table and the list of...
void setParticipant(Participant &p)
void setPRIVPrefix(Participant *part, const std::string val)
unsigned char * getSenderInfo()
SyncSourceLink * getNextCollis()
Get the link object for the next RTP source in the hash table entry collision list.
IncomingRTPPkt * getPacket() const
Interface (envelope) to data received over RTP packets.
The implementation for a SRTP cryptographic context.
void setMinValidPacketSequence(uint8 packets)
When receiving packets from a new source, it may be convenient to reject a first few packets before w...
void setControlTransportPort(tpport_t p)
uint8 getProbation() const
void setSender(SyncSource &source, bool active)
ConflictingTransportAddress * getPrevConflict() const
void removeParticipant(RTPApplication &app, RTPApplication::ParticipantLink *pl)
const SyncSource * pointer
void setProbation(uint8 p)
RTP packets received from other participants.
uint32 lastPacketTransitTime
unsigned char * getReceiverInfo()
uint32 getInitialDataTimestamp() const
static const size_t defaultMembersSize
timeval getRecvTime() const
Get the time this packet was received at.
void setState(SyncSource &source, SyncSource::State ns)
virtual bool end2EndDelayed(IncomingRTPPktLink &)
void setNext(IncomingRTPPktLink *nl)
unsigned short tpport_t
Transport Protocol Ports.
SyncSourceLink * getNext()
Get the link object for the next RTP source.
unsigned char * receiverInfo
SyncSourceLink(MembershipBookkeeping *m, SyncSource *s, IncomingRTPPktLink *fp=NULL, IncomingRTPPktLink *lp=NULL, SyncSourceLink *ps=NULL, SyncSourceLink *ns=NULL, SyncSourceLink *ncollis=NULL)
SyncSourcesIterator operator++(int)
static size_t getDefaultMembersSize()
uint32 getExtendedMaxSeqNum() const
const SyncSource & reference
bool getGoodbye()
Mark this source as having sent a BYE control packet.
The Mutex class is used to protect a section of code so that at any given time only a single thread c...
virtual void onNewSyncSource(const SyncSource &)
Virtual called when a new synchronization source has joined the session.
Queue for incoming RTP data packets in an RTP session.
ConflictingTransportAddress * prevConflict
uint8 minValidPacketSequence
void setExtendedMaxSeqNum(uint32 seq)
void increaseMembersCount()
uint8 getMinValidPacketSequence() const
Get the minimun number of consecutive packets that must be received from a source before accepting it...
IncomingRTPPktLink * prev
tpport_t controlTransportPort
void setMaxPacketMisorder(uint16 packets)
Participant objects modification methods.
uint32 getObservedPacketCount() const
Get the total number of RTP packets received from this source.
void incObservedOctetCount(uint32 n)
void setPacket(IncomingRTPPkt *pkt)
void setNextCollis(SyncSourceLink *ns)
IncomingRTPPktLink * getLast()
Get last RTP (data) packet in the queue of packets received from this socket.
uint16 getMaxPacketMisorder() const
void increaseSendersCount()
SyncSourceLink ** sourceLinks
static const uint16 defaultMaxPacketMisorder
Synchronization Source internal handler within the incoming packets queue.
uint16 getDefaultMaxPacketMisorder() const
IncomingRTPPktLink * getPrev() const
reference operator*() const
members and senders accounting
SyncSource * getSource()
Get the synchronization source object this link objet holds information for.
uint32 getMembersCount() const
void * getLink(const SyncSource &source) const
This requires SyncSource - SyncSourceHandler friendship.
To track addresses of sources conflicting with the local one.
IncomingRTPPktLink * getNext() const
State
Synchronization source states during an RTP session.
Application objects modification methods.
A class of objects representing remote participants (RTP applications) in a multimedia session...
uint8 sourceExpirationPeriod
uint32 getLastPacketTransitTime()
IncomingRTPPktLink * getSrcNext() const
void setNext(ConflictingTransportAddress *nc)
pointer operator->() const
size_t getDefaultMembersHashSize()
timeval getLastRTCPPacketTime() const
void setNext(SyncSourceLink *ns)
uint32 getSendersCount() const
void setNetworkAddress(SyncSource &source, InetAddress addr)
timeval lastRTCPPacketTime
SyncSourcesIterator & operator++()
Base classes for RTP queues.
SyncSourceLink * nextCollis
IncomingRTPPktLink * getFirst()
Get first RTP (data) packet in the queue of packets received from this socket.
MembershipBookkeeping * getMembership()
bool isMine(const SyncSource &source) const
Get whether a synchronization source is recorded in this membership controller.
void setSDESItem(Participant *part, SDESItemType item, const std::string &val)
static const size_t defaultMembersHashSize
void setParticipant(SyncSource &source, Participant &p)
void setDataTransportPort(SyncSource &source, tpport_t p)
ptrdiff_t difference_type
IncomingRTPPktLink * getSrcPrev() const
The ThreadLock class impliments a thread rwlock for optimal reader performance on systems which have ...
SyncSourceLink * getLast()
unsigned char * senderInfo
void addParticipant(Participant &part)
timeval getLastRTCPSRTime() const
void removeParticipant(ParticipantLink *part)
void setSender(bool active)
Mark this source as an active sender.
uint32 initialDataTimestamp
SyncSourceLink * getSourceLink() const
void setInitialDataTimestamp(uint32 ts)
const InetAddress & getNetworkAddress() const
SyncSourceLink * sourceLink
timeval getInitialDataTime() const
uint32 getBadSeqNum() const
InetAddress networkAddress
virtual ~ApplicationHandler()
static const uint8 defaultMinValidPacketSequence
void setPrev(SyncSourceLink *ps)
void setMembersCount(uint32 n)
virtual ~IncomingDataQueue()
MembershipBookkeeping * membership
uint16 getMaxPacketDropout() const
void setBadSeqNum(uint32 seq)
void setSrcPrev(IncomingRTPPktLink *sp)
uint16 getDefaultMaxPacketDropout() const
uint8 getFractionLost() const
friend bool operator!=(const SyncSourcesIterator &l, const SyncSourcesIterator &r)
uint32 getSeqNumAccum() const
void setCumulativePacketLost(uint32 pl)
Controls the group membership in the current session.
void setSrcNext(IncomingRTPPktLink *sn)
IncomingRTPPktLink * recvLast
virtual ~ConflictHandler()
SyncSourceLink * getFirst()
SyncSourcesIterator begin()
SyncSourcesIterator(SyncSourceLink *l=NULL)
ConflictingTransportAddress * lastConflict
IncomingRTPPktLink * srcPrev
tpport_t dataTransportPort
virtual void onExpireRecv(IncomingRTPPkt &)
A hook to filter packets in the receive queue that are being expired.
void decreaseSendersCount()
void decreaseMembersCount()
void setLink(SyncSource &source, void *link)
uint16 getMaxSeqNum() const
Get the highest valid sequence number received.
void setSendersCount(uint32 n)
void setMaxSeqNum(uint16 max)
Set the highest valid sequence number recived.
SyncSourcesIterator(const SyncSourcesIterator &si)
SyncSourceLink * getPrev()
Get the link object for the previous RTP source.
void setDataTransportPort(tpport_t p)
SyncSourceLink * getLink(const SyncSource &source) const
void initSequence(uint16 seqnum)
Start a new sequence of received packets.
void setPrev(IncomingRTPPktLink *pl)
Incoming RTP data packets control structure within the incoming packet queue class.
virtual bool onSRTPPacketError(IncomingRTPPkt &pkt, int32 errorCode)
A hook that gets called if the decoding of an incoming SRTP was erroneous.
uint32 getObservedOctetCount() const
Get the total number of payload octets received from this source.
timeval getLastPacketTime() const
SyncSource objects modification methods.
SyncSourcesIterator end()
void updateConflict(ConflictingTransportAddress &ca)
void setMaxPacketDropout(uint16 packets)
It also prevents packets sent after a restart of the source being immediately accepted.
uint8 getDefaultMinValidPacketSequence() const
friend bool operator==(const SyncSourcesIterator &l, const SyncSourcesIterator &r)
tpport_t getDataTransportPort() const
void setPRIVPrefix(const std::string val)
Set prefix value for the PRIV SDES item.
void setLast(IncomingRTPPktLink *lp)
void setFractionLost(uint8 fl)
virtual ~SyncSourceHandler()
IncomingRTPPktLink * last
uint32 getTimestamp() const
Get timestamp of this packet.
std::list< CryptoContext * > cryptoContexts
void setLastPacketTransitTime(uint32 time)
void setTimestamp(uint32 ts)
SDESItemType
SDES items that may be carried in a Source DEScription RTCP packet.
bool getHello()
Mark this source as having sent some packet.
uint32 getCumulativePacketLost() const
tpport_t getControlTransportPort() const
uint32 cumulativePacketLost
void setSDESItem(SDESItemType item, const std::string &val)
Set the value of a SDES item.
uint32 members
number of identified members
uint32 activeSenders
number of identified members that currently are active senders
IncomingRTPPktLink(IncomingRTPPkt *pkt, SyncSourceLink *sLink, struct timeval &recv_ts, uint32 shifted_ts, IncomingRTPPktLink *sp, IncomingRTPPktLink *sn, IncomingRTPPktLink *p, IncomingRTPPktLink *n)
void setInitialDataTime(timeval it)
void setSourceLink(SyncSourceLink *src)
void setControlTransportPort(SyncSource &source, tpport_t p)
iterator through the list of synchronizations sources in this session
void setNetworkAddress(InetAddress addr)
static const uint32 SEQNUMMOD
void setRecvTime(const timeval &t)
Set the time this packet was received at.