43 #ifndef CCXX_RTP_IQUEUE_H_
44 #define CCXX_RTP_IQUEUE_H_
88 { activeSenders = n; }
100 {
return activeSenders; }
184 const std::string& val)
238 tpport_t dtp, tpport_t ctp);
244 {
return networkAddress; }
247 {
return dataTransportPort; }
250 {
return controlTransportPort; }
276 void addConflict(
const InetAddress& na, tpport_t dtp, tpport_t ctp);
280 { firstConflict = lastConflict = NULL; }
307 {
return defaultMembersHashSize; }
334 struct SyncSourceLink;
343 {
return getLink(source)->getMembership() ==
this; }
354 struct timeval& recv_ts,
363 srcPrev(sp), srcNext(sn),
364 receptionTime(recv_ts),
365 shiftedTimestamp(shifted_ts)
372 {
return sourceLink; }
375 { sourceLink = src; }
415 { receptionTime = t; }
421 {
return receptionTime; }
432 {
return shiftedTimestamp; }
435 { shiftedTimestamp = ts;}
446 struct timeval receptionTime;
481 membership(m), source(s), first(fp), last(lp),
482 prev(ps), next(ns), nextCollis(ncollis),
494 {
return membership; }
547 {
return nextCollis; }
553 {
return prevConflict; }
558 void setPrevConflict(InetAddress& addr, tpport_t dataPort,
559 tpport_t controlPort);
562 {
return senderInfo; }
564 void setSenderInfo(
unsigned char* si);
567 {
return receiverInfo; }
569 void setReceiverInfo(
unsigned char* ri);
572 {
return lastPacketTime; }
575 {
return lastRTCPPacketTime; }
578 {
return lastRTCPSRTime; }
585 {
return obsPacketCount; }
588 { obsPacketCount++; }
595 {
return obsOctetCount; }
598 { obsOctetCount += n; }
605 {
return maxSeqNum; }
617 {
return extendedMaxSeqNum; }
621 { extendedMaxSeqNum = seq; }
624 {
return cumulativePacketLost; }
627 { cumulativePacketLost = pl; }
630 {
return fractionLost; }
633 { fractionLost = fl; }
636 {
return lastPacketTransitTime; }
639 { lastPacketTransitTime = time; }
648 {
return initialDataTimestamp; }
651 { initialDataTimestamp = ts; }
654 {
return initialDataTime; }
657 { initialDataTime = it; }
688 {
return badSeqNum; }
694 {
return probation; }
703 {
return 0 == probation; }
706 {
return baseSeqNum; }
709 { baseSeqNum = seqnum; }
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,
1104 bool is_new, InetAddress& na,
1123 { sourceExpirationPeriod = intervals; }
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,
1272 InetHostAddress& host, tpport_t& port) = 0;
1275 getNextDataPacketSize()
const = 0;
1297 #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
void setBaseSeqNum(uint16 seqnum)
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)
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.
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
virtual void renewLocalSSRC()
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)
std::ptrdiff_t difference_type
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)
IncomingRTPPktLink * getSrcPrev() const
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)
static const uint32 SEQNUMMOD
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)
void setRecvTime(const timeval &t)
Set the time this packet was received at.