47 networkAddress(na), dataTransportPort(dtp),
48 controlTransportPort(ctp), next(NULL)
59 result = result->
next;
70 result = result->
next;
130 const uint32 MAXTRIES = 20;
136 }
while ( (tries < MAXTRIES) &&
isRegistered(newssrc) );
138 if ( MAXTRIES == tries ) {
183 InetHostAddress network_address;
184 tpport_t transport_port;
187 unsigned char* buffer =
new unsigned char[nextSize];
188 int32 rtn = (int32)
recvData(buffer,nextSize,network_address,transport_port);
195 struct timeval recvtime;
196 SysTime::gettimeofday(&recvtime,NULL);
203 uint8 padSet = (*buffer & 0x20);
205 *buffer = *buffer & ~0x20;
250 if ( source_created ) {
263 }
else if ( 0 == s->getDataTransportPort() ) {
275 network_address,transport_port) &&
284 NULL,NULL,NULL,NULL);
300 bool is_new, InetAddress& network_address, tpport_t transport_port)
355 dispatchBYE(
"SSRC collision detected when receiving data packet.");
375 if ( plink && (seq < plink->getPacket()->getSeqNum()) ) {
377 while ( plink && (seq < plink->getPacket()->getSeqNum()) ){
381 VDL((
"Duplicated disordered packet: seqnum %d, SSRC:",
401 prevFirst->
setNext(packetLink);
402 packetLink->
setPrev(prevFirst);
447 VDL((
"Duplicated packet: seqnum %d, SSRC:",
498 if ( src && !
isMine(*src) )
525 bool nonempty =
false;
526 for (
int i = 0; i < nold; i++) {
582 for (
int i = 0; i < nold; i++) {
707 timersub(&lastT,&initial,&tarrival);
711 int32 delta = transitTime -
718 (static_cast<float>(delta) -
731 std::list<CryptoContext *>::iterator i;
737 if( (*i)->getSsrc() == cc->
getSsrc() ) {
750 std::list<CryptoContext *>::iterator i;
762 if( (*i)->getSsrc() == cc->
getSsrc() ) {
775 std::list<CryptoContext *>::iterator i;
779 if( (*i)->getSsrc() == ssrc) {
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
IncomingDataQueue::IncomingRTPPktLink * getWaiting(uint32 timestamp, const SyncSource *src=NULL)
This is used to fetch a packet in the receive queue and to expire packets older than the current time...
static const uint32 SEQNUMMOD
void setBaseSeqNum(uint16 seqnum)
ConflictingTransportAddress * searchDataConflict(InetAddress na, tpport_t dtp)
virtual size_t dispatchBYE(const std::string &)
A plugin point for posting of BYE messages.
tpport_t getDataTransportPort() const
Synchronization source in an RTP session.
void incObservedPacketCount()
IncomingRTPPkt * getPacket() const
Interface (envelope) to data received over RTP packets.
The implementation for a SRTP cryptographic context.
void setSender(SyncSource &source, bool active)
ConflictingTransportAddress * getPrevConflict() const
void setPrevConflict(InetAddress &addr, tpport_t dataPort, tpport_t controlPort)
Get conflicting address.
void reComputePayLength(bool padding)
Re-compute payload length.
void setProbation(uint8 p)
RTP packets received from other participants.
void recordExtraction(const IncomingRTPPkt &pkt)
Log extraction of a packet from this source from the scheduled reception queue.
uint32 getInitialDataTimestamp() const
static const size_t defaultMembersSize
virtual bool end2EndDelayed(IncomingRTPPktLink &)
bool isRegistered(uint32 ssrc)
Returns whether there is already a synchronizacion source with "ssrc" SSRC identifier.
void setNext(IncomingRTPPktLink *nl)
microtimeout_t timeval2microtimeout(const timeval &t)
Convert a time interval, expressed as a timeval value into a microseconds counter.
virtual size_t recvData(unsigned char *buffer, size_t length, InetHostAddress &host, tpport_t &port)=0
This function performs the physical I/O for reading a packet from the source.
bool checkSSRCInIncomingRTPPkt(SyncSourceLink &sourceLink, bool is_new, InetAddress &na, tpport_t tp)
Apply collision and loop detection and correction algorithm when receiving RTP data packets...
virtual void onNewSyncSource(const SyncSource &)
Virtual called when a new synchronization source has joined the session.
uint8 minValidPacketSequence
size_t getMaxRecvPacketSize() const
uint8 getMinValidPacketSequence() const
Get the minimun number of consecutive packets that must be received from a source before accepting it...
uint32 getSSRC() const
Get synchronization source numeric identifier.
tpport_t controlTransportPort
uint32 getObservedPacketCount() const
Get the total number of RTP packets received from this source.
void incObservedOctetCount(uint32 n)
Declaration of ccRTP internal stuff.
IncomingRTPPktLink * getLast()
Get last RTP (data) packet in the queue of packets received from this socket.
uint16 getMaxPacketMisorder() const
int32 unprotect(CryptoContext *pcc)
Unprotect a received packet.
static const uint16 defaultMaxPacketMisorder
Synchronization Source internal handler within the incoming packets queue.
uint16 getDefaultMaxPacketMisorder() const
IncomingRTPPktLink * getPrev() const
SyncSource * getSource()
Get the synchronization source object this link objet holds information for.
IncomingRTPPktLink * getNext() const
uint32 getTimestamp() const
bool isHeaderValid()
Get validity of this packet.
uint8 sourceExpirationPeriod
uint32 getLastPacketTransitTime()
IncomingRTPPktLink * getSrcNext() const
void setNext(ConflictingTransportAddress *nc)
IncomingDataQueue(uint32 size)
static const size_t defaultMaxRecvPacketSize
Generic RTP input queues.
void setNetworkAddress(SyncSource &source, InetAddress addr)
CryptoContext * newCryptoContextForSSRC(uint32 ssrc, int roc, int64 keyDerivRate)
Derive a new Crypto Context for use with a new SSRC.
bool isWaiting(const SyncSource *src=NULL) const
Determine if packets are waiting in the reception queue.
IncomingRTPPktLink * getFirst()
Get first RTP (data) packet in the queue of packets received from this socket.
bool isMine(const SyncSource &source) const
Get whether a synchronization source is recorded in this membership controller.
bool recordReception(SyncSourceLink &srcLink, const IncomingRTPPkt &pkt, const timeval recvtime)
Log reception of a new RTP packet from this source.
static const size_t defaultMembersHashSize
CryptoContext * getInQueueCryptoContext(uint32 ssrc)
Get an input queue CryptoContext identified by SSRC.
void setDataTransportPort(SyncSource &source, tpport_t p)
bool insertRecvPacket(IncomingRTPPktLink *packetLink)
Insert a just received packet in the queue (both general and source specific queues).
IncomingRTPPktLink * getSrcPrev() const
const AppDataUnit * getData(uint32 stamp, const SyncSource *src=NULL)
Retreive data from a specific timestamped packet if such a packet is currently available in the recei...
void recordInsertion(const IncomingRTPPktLink &pl)
Record the insertion of an RTP packet from this source into the scheduled reception queue...
const InetAddress & getNetworkAddress() const
SyncSourceLink * getSourceLink() const
IncomingRTPPktLink * recvFirst
void setInitialDataTimestamp(uint32 ts)
tpport_t getControlTransportPort() const
SyncSourceLink * getSourceBySSRC(uint32 ssrc, bool &created)
Get the description of a source by its ssrc identifier.
timeval getInitialDataTime() const
uint32 getBadSeqNum() const
InetAddress networkAddress
virtual size_t takeInDataPacket()
This function is used by the service thread to process the next incoming packet and place it in the r...
void purgeIncomingQueue()
static const uint8 defaultMinValidPacketSequence
uint32 getPayloadSize() const
uint32 getLocalSSRC() const
uint16 getMaxPacketDropout() const
void setBadSeqNum(uint32 seq)
void setSrcPrev(IncomingRTPPktLink *sp)
uint16 getDefaultMaxPacketDropout() const
void deriveSrtpKeys(uint64 index)
Perform key derivation according to SRTP specification.
uint32 getSsrc() const
Get the SSRC of this SRTP Cryptograhic context.
Controls the group membership in the current session.
void setSrcNext(IncomingRTPPktLink *sn)
IncomingRTPPktLink * recvLast
ConflictingTransportAddress * lastConflict
uint32 getCurrentRTPClockRate() const
Get the clock rate in RTP clock units (for instance, 8000 units per second for PCMU, or 90000 units per second for MP2T).
tpport_t dataTransportPort
ConflictingTransportAddress(InetAddress na, tpport_t dtp, tpport_t ctp)
uint32 getFirstTimestamp(const SyncSource *src=NULL) const
Get timestamp of first packet waiting in the queue.
virtual void onExpireRecv(IncomingRTPPkt &)
A hook to filter packets in the receive queue that are being expired.
void addConflict(const InetAddress &na, tpport_t dtp, tpport_t ctp)
uint16 getMaxSeqNum() const
Get the highest valid sequence number received.
void setMaxSeqNum(uint16 max)
Set the highest valid sequence number recived.
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.
timeval getLastPacketTime() const
void updateConflict(ConflictingTransportAddress &ca)
uint8 getDefaultMinValidPacketSequence() const
void setLast(IncomingRTPPktLink *lp)
void removeInQueueCryptoContext(CryptoContext *cc)
Remove input queue CryptoContext.
virtual size_t getNextDataPacketSize() const =0
uint32 getTimestamp() const
Get timestamp of this packet.
std::list< CryptoContext * > cryptoContexts
void setLastPacketTransitTime(uint32 time)
ConflictingTransportAddress * firstConflict
ConflictingTransportAddress * searchControlConflict(InetAddress na, tpport_t ctp)
bool getHello()
Mark this source as having sent some packet.
void setInQueueCryptoContext(CryptoContext *cc)
Set input queue CryptoContext.
void setInitialDataTime(timeval it)
void setControlTransportPort(SyncSource &source, tpport_t p)