ccRTP
|
00001 // Copyright (C) 2001,2002,2004 Federico Montesino Pouzols <fedemp@altern.org>. 00002 // 00003 // This program is free software; you can redistribute it and/or modify 00004 // it under the terms of the GNU General Public License as published by 00005 // the Free Software Foundation; either version 2 of the License, or 00006 // (at your option) any later version. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00016 // 00017 // As a special exception, you may use this file as part of a free software 00018 // library without restriction. Specifically, if other files instantiate 00019 // templates or use macros or inline functions from this file, or you compile 00020 // this file and link it with other files to produce an executable, this 00021 // file does not by itself cause the resulting executable to be covered by 00022 // the GNU General Public License. This exception does not however 00023 // invalidate any other reasons why the executable file might be covered by 00024 // the GNU General Public License. 00025 // 00026 // This exception applies only to the code released under the name GNU 00027 // ccRTP. If you copy code from other releases into a copy of GNU 00028 // ccRTP, as the General Public License permits, the exception does 00029 // not apply to the code that you add in this way. To avoid misleading 00030 // anyone as to the status of such modified files, you must delete 00031 // this exception notice from them. 00032 // 00033 // If you write modifications of your own for GNU ccRTP, it is your choice 00034 // whether to permit this exception to apply to your modifications. 00035 // If you do not wish that, delete this exception notice. 00036 // 00037 00044 #ifndef CCXX_RTP_IQUEUE_H_ 00045 #define CCXX_RTP_IQUEUE_H_ 00046 00047 #include <ccrtp/queuebase.h> 00048 #include <ccrtp/CryptoContext.h> 00049 00050 #include <list> 00051 00052 NAMESPACE_COMMONCPP 00053 00068 class __EXPORT Members 00069 { 00070 public: 00071 inline void 00072 setMembersCount(uint32 n) 00073 { members = n; } 00074 00075 inline void 00076 increaseMembersCount() 00077 { members++; } 00078 00079 inline void 00080 decreaseMembersCount() 00081 { members--; } 00082 00083 inline uint32 00084 getMembersCount() const 00085 { return members; } 00086 00087 inline void 00088 setSendersCount(uint32 n) 00089 { activeSenders = n; } 00090 00091 inline void 00092 increaseSendersCount() 00093 { activeSenders++; } 00094 00095 inline void 00096 decreaseSendersCount() 00097 { activeSenders--; } 00098 00099 inline uint32 00100 getSendersCount() const 00101 { return activeSenders; } 00102 00103 protected: 00104 Members() : 00105 members(0), 00106 activeSenders(0) 00107 { } 00108 00109 inline virtual ~Members() 00110 { } 00111 00112 private: 00114 uint32 members; 00116 uint32 activeSenders; 00117 }; 00118 00125 class __EXPORT SyncSourceHandler 00126 { 00127 public: 00134 inline void* 00135 getLink(const SyncSource& source) const 00136 { return source.getLink(); } 00137 00138 inline void 00139 setLink(SyncSource& source, void* link) 00140 { source.setLink(link); } 00141 00142 inline void 00143 setParticipant(SyncSource& source, Participant& p) 00144 { source.setParticipant(p); } 00145 00146 inline void 00147 setState(SyncSource& source, SyncSource::State ns) 00148 { source.setState(ns); } 00149 00150 inline void 00151 setSender(SyncSource& source, bool active) 00152 { source.setSender(active); } 00153 00154 inline void 00155 setDataTransportPort(SyncSource& source, tpport_t p) 00156 { source.setDataTransportPort(p); } 00157 00158 inline void 00159 setControlTransportPort(SyncSource& source, tpport_t p) 00160 { source.setControlTransportPort(p); } 00161 00162 inline void 00163 setNetworkAddress(SyncSource& source, InetAddress addr) 00164 { source.setNetworkAddress(addr); } 00165 00166 protected: 00167 SyncSourceHandler() 00168 { } 00169 00170 inline virtual ~SyncSourceHandler() 00171 { } 00172 }; 00173 00180 class __EXPORT ParticipantHandler 00181 { 00182 public: 00183 inline void 00184 setSDESItem(Participant* part, SDESItemType item, 00185 const std::string& val) 00186 { part->setSDESItem(item,val); } 00187 00188 inline void 00189 setPRIVPrefix(Participant* part, const std::string val) 00190 { part->setPRIVPrefix(val); } 00191 00192 protected: 00193 ParticipantHandler() 00194 { } 00195 00196 inline virtual ~ParticipantHandler() 00197 { } 00198 }; 00199 00206 class __EXPORT ApplicationHandler 00207 { 00208 public: 00209 inline void 00210 addParticipant(RTPApplication& app, Participant& part) 00211 { app.addParticipant(part); } 00212 00213 inline void 00214 removeParticipant(RTPApplication& app, 00215 RTPApplication::ParticipantLink* pl) 00216 { app.removeParticipant(pl); } 00217 00218 protected: 00219 ApplicationHandler() 00220 { } 00221 00222 inline virtual ~ApplicationHandler() 00223 { } 00224 }; 00225 00233 class __EXPORT ConflictHandler 00234 { 00235 public: 00236 struct ConflictingTransportAddress 00237 { 00238 ConflictingTransportAddress(InetAddress na, 00239 tpport_t dtp, tpport_t ctp); 00240 00241 void setNext(ConflictingTransportAddress* nc) 00242 { next = nc; } 00243 00244 inline const InetAddress& getNetworkAddress( ) const 00245 { return networkAddress; } 00246 00247 inline tpport_t getDataTransportPort() const 00248 { return dataTransportPort; } 00249 00250 inline tpport_t getControlTransportPort() const 00251 { return controlTransportPort; } 00252 00253 InetAddress networkAddress; 00254 tpport_t dataTransportPort; 00255 tpport_t controlTransportPort; 00256 ConflictingTransportAddress* next; 00257 // arrival time of last data or control packet. 00258 timeval lastPacketTime; 00259 }; 00260 00265 ConflictingTransportAddress* searchDataConflict(InetAddress na, 00266 tpport_t dtp); 00271 ConflictingTransportAddress* searchControlConflict(InetAddress na, 00272 tpport_t ctp); 00273 00274 void updateConflict(ConflictingTransportAddress& ca) 00275 { SysTime::gettimeofday(&(ca.lastPacketTime),NULL); } 00276 00277 void addConflict(const InetAddress& na, tpport_t dtp, tpport_t ctp); 00278 00279 protected: 00280 ConflictHandler() 00281 { firstConflict = lastConflict = NULL; } 00282 00283 inline virtual ~ConflictHandler() 00284 { } 00285 00286 ConflictingTransportAddress* firstConflict, * lastConflict; 00287 }; 00288 00299 class __EXPORT MembershipBookkeeping : 00300 public SyncSourceHandler, 00301 public ParticipantHandler, 00302 public ApplicationHandler, 00303 public ConflictHandler, 00304 private Members 00305 { 00306 public: 00307 inline size_t getDefaultMembersHashSize() 00308 { return defaultMembersHashSize; } 00309 00310 protected: 00311 00325 MembershipBookkeeping(uint32 initialSize = defaultMembersHashSize); 00326 00331 inline virtual 00332 ~MembershipBookkeeping() 00333 { endMembers(); } 00334 00335 struct SyncSourceLink; 00336 00337 inline SyncSourceLink* getLink(const SyncSource& source) const 00338 { return static_cast<SyncSourceLink*>(SyncSourceHandler::getLink(source)); } 00343 inline bool isMine(const SyncSource& source) const 00344 { return getLink(source)->getMembership() == this; } 00345 00352 struct IncomingRTPPktLink 00353 { 00354 IncomingRTPPktLink(IncomingRTPPkt* pkt, SyncSourceLink* sLink, 00355 struct timeval& recv_ts, 00356 uint32 shifted_ts, 00357 IncomingRTPPktLink* sp, 00358 IncomingRTPPktLink* sn, 00359 IncomingRTPPktLink* p, 00360 IncomingRTPPktLink* n) : 00361 packet(pkt), 00362 sourceLink(sLink), 00363 prev(p), next(n), 00364 srcPrev(sp), srcNext(sn), 00365 receptionTime(recv_ts), 00366 shiftedTimestamp(shifted_ts) 00367 { } 00368 00369 ~IncomingRTPPktLink() 00370 { } 00371 00372 inline SyncSourceLink* getSourceLink() const 00373 { return sourceLink; } 00374 00375 inline void setSourceLink(SyncSourceLink* src) 00376 { sourceLink = src; } 00377 00378 inline IncomingRTPPktLink* getNext() const 00379 { return next; } 00380 00381 inline void setNext(IncomingRTPPktLink* nl) 00382 { next = nl; } 00383 00384 inline IncomingRTPPktLink* getPrev() const 00385 { return prev; } 00386 00387 inline void setPrev(IncomingRTPPktLink* pl) 00388 { prev = pl; } 00389 00390 inline IncomingRTPPktLink* getSrcNext() const 00391 { return srcNext; } 00392 00393 inline void setSrcNext(IncomingRTPPktLink* sn) 00394 { srcNext = sn; } 00395 00396 inline IncomingRTPPktLink* getSrcPrev() const 00397 { return srcPrev; } 00398 00399 inline void setSrcPrev(IncomingRTPPktLink* sp) 00400 { srcPrev = sp; } 00401 00402 inline IncomingRTPPkt* getPacket() const 00403 { return packet; } 00404 00405 inline void setPacket(IncomingRTPPkt* pkt) 00406 { packet = pkt; } 00407 00415 inline void setRecvTime(const timeval &t) 00416 { receptionTime = t; } 00417 00421 inline timeval getRecvTime() const 00422 { return receptionTime; } 00423 00432 inline uint32 getTimestamp() const 00433 { return shiftedTimestamp; } 00434 00435 inline void setTimestamp(uint32 ts) 00436 { shiftedTimestamp = ts;} 00437 00438 // the packet this link refers to. 00439 IncomingRTPPkt* packet; 00440 // the synchronization source this packet comes from. 00441 SyncSourceLink* sourceLink; 00442 // global incoming packet queue links. 00443 IncomingRTPPktLink* prev, * next; 00444 // source specific incoming packet queue links. 00445 IncomingRTPPktLink* srcPrev, * srcNext; 00446 // time this packet was received at 00447 struct timeval receptionTime; 00448 // timestamp of the packet in host order and after 00449 // substracting the initial timestamp for its source 00450 // (it is an increment from the initial timestamp). 00451 uint32 shiftedTimestamp; 00452 }; 00453 00470 struct SyncSourceLink 00471 { 00472 // 2^16 00473 static const uint32 SEQNUMMOD; 00474 00475 SyncSourceLink(MembershipBookkeeping* m, 00476 SyncSource* s, 00477 IncomingRTPPktLink* fp = NULL, 00478 IncomingRTPPktLink* lp = NULL, 00479 SyncSourceLink* ps = NULL, 00480 SyncSourceLink* ns = NULL, 00481 SyncSourceLink* ncollis = NULL) : 00482 membership(m), source(s), first(fp), last(lp), 00483 prev(ps), next(ns), nextCollis(ncollis), 00484 prevConflict(NULL) 00485 { m->setLink(*s,this); // record that the source is associated 00486 initStats(); // to this link. 00487 } 00488 00492 ~SyncSourceLink(); 00493 00494 inline MembershipBookkeeping* getMembership() 00495 { return membership; } 00496 00501 inline SyncSource* getSource() { return source; } 00502 00507 inline IncomingRTPPktLink* getFirst() 00508 { return first; } 00509 00510 inline void setFirst(IncomingRTPPktLink* fp) 00511 { first = fp; } 00512 00517 inline IncomingRTPPktLink* getLast() 00518 { return last; } 00519 00520 inline void setLast(IncomingRTPPktLink* lp) 00521 { last = lp; } 00522 00526 inline SyncSourceLink* getPrev() 00527 { return prev; } 00528 00529 inline void setPrev(SyncSourceLink* ps) 00530 { prev = ps; } 00531 00535 inline SyncSourceLink* getNext() 00536 { return next; } 00537 00538 inline void setNext(SyncSourceLink *ns) 00539 { next = ns; } 00540 00547 inline SyncSourceLink* getNextCollis() 00548 { return nextCollis; } 00549 00550 inline void setNextCollis(SyncSourceLink* ns) 00551 { nextCollis = ns; } 00552 00553 inline ConflictingTransportAddress* getPrevConflict() const 00554 { return prevConflict; } 00555 00559 void setPrevConflict(InetAddress& addr, tpport_t dataPort, 00560 tpport_t controlPort); 00561 00562 unsigned char* getSenderInfo() 00563 { return senderInfo; } 00564 00565 void setSenderInfo(unsigned char* si); 00566 00567 unsigned char* getReceiverInfo() 00568 { return receiverInfo; } 00569 00570 void setReceiverInfo(unsigned char* ri); 00571 00572 inline timeval getLastPacketTime() const 00573 { return lastPacketTime; } 00574 00575 inline timeval getLastRTCPPacketTime() const 00576 { return lastRTCPPacketTime; } 00577 00578 inline timeval getLastRTCPSRTime() const 00579 { return lastRTCPSRTime; } 00580 00585 inline uint32 getObservedPacketCount() const 00586 { return obsPacketCount; } 00587 00588 inline void incObservedPacketCount() 00589 { obsPacketCount++; } 00590 00595 inline uint32 getObservedOctetCount() const 00596 { return obsOctetCount; } 00597 00598 inline void incObservedOctetCount(uint32 n) 00599 { obsOctetCount += n; } 00600 00604 uint16 00605 getMaxSeqNum() const 00606 { return maxSeqNum; } 00607 00612 void 00613 setMaxSeqNum(uint16 max) 00614 { maxSeqNum = max; } 00615 00616 inline uint32 00617 getExtendedMaxSeqNum() const 00618 { return extendedMaxSeqNum; } 00619 00620 inline void 00621 setExtendedMaxSeqNum(uint32 seq) 00622 { extendedMaxSeqNum = seq; } 00623 00624 inline uint32 getCumulativePacketLost() const 00625 { return cumulativePacketLost; } 00626 00627 inline void setCumulativePacketLost(uint32 pl) 00628 { cumulativePacketLost = pl; } 00629 00630 inline uint8 getFractionLost() const 00631 { return fractionLost; } 00632 00633 inline void setFractionLost(uint8 fl) 00634 { fractionLost = fl; } 00635 00636 inline uint32 getLastPacketTransitTime() 00637 { return lastPacketTransitTime; } 00638 00639 inline void setLastPacketTransitTime(uint32 time) 00640 { lastPacketTransitTime = time; } 00641 00642 inline float getJitter() const 00643 { return jitter; } 00644 00645 inline void setJitter(float j) 00646 { jitter = j; } 00647 00648 inline uint32 getInitialDataTimestamp() const 00649 { return initialDataTimestamp; } 00650 00651 inline void setInitialDataTimestamp(uint32 ts) 00652 { initialDataTimestamp = ts; } 00653 00654 inline timeval getInitialDataTime() const 00655 { return initialDataTime; } 00656 00657 inline void setInitialDataTime(timeval it) 00658 { initialDataTime = it; } 00659 00667 bool getGoodbye() 00668 { 00669 if(!flag) 00670 return false; 00671 flag = false; 00672 return true; 00673 } 00674 00681 bool getHello() { 00682 if(flag) 00683 return false; 00684 flag = true; 00685 return true; 00686 } 00687 00688 inline uint32 getBadSeqNum() const 00689 { return badSeqNum; } 00690 00691 inline void setBadSeqNum(uint32 seq) 00692 { badSeqNum = seq; } 00693 00694 uint8 getProbation() const 00695 { return probation; } 00696 00697 inline void setProbation(uint8 p) 00698 { probation = p; } 00699 00700 inline void decProbation() 00701 { --probation; } 00702 00703 bool isValid() const 00704 { return 0 == probation; } 00705 00706 inline uint16 getBaseSeqNum() const 00707 { return baseSeqNum; } 00708 00709 inline void setBaseSeqNum(uint16 seqnum) 00710 { baseSeqNum = seqnum; } 00711 00712 inline uint32 getSeqNumAccum() const 00713 { return seqNumAccum; } 00714 00715 inline void incSeqNumAccum() 00716 { seqNumAccum += SEQNUMMOD; } 00717 00721 inline void initSequence(uint16 seqnum) 00722 { maxSeqNum = seqNumAccum = seqnum; } 00723 00734 void recordInsertion(const IncomingRTPPktLink& pl); 00735 00736 void initStats(); 00737 00742 void computeStats(); 00743 00744 MembershipBookkeeping* membership; 00745 // The source this link object refers to. 00746 SyncSource* source; 00747 // first/last packets from this source in the queue. 00748 IncomingRTPPktLink* first, * last; 00749 // Links for synchronization sources located before 00750 // and after this one in the list of sources. 00751 SyncSourceLink* prev, * next; 00752 // Prev and next inside the hash table collision list. 00753 SyncSourceLink* nextCollis; 00754 ConflictingTransportAddress* prevConflict; 00755 unsigned char* senderInfo; 00756 unsigned char* receiverInfo; 00757 // time the last RTP packet from this source was 00758 // received at. 00759 timeval lastPacketTime; 00760 // time the last RTCP packet was received. 00761 timeval lastRTCPPacketTime; 00762 // time the lasrt RTCP SR was received. Required for 00763 // DLSR computation. 00764 timeval lastRTCPSRTime; 00765 00766 // for outgoing RR reports. 00767 // number of packets received from this source. 00768 uint32 obsPacketCount; 00769 // number of octets received from this source. 00770 uint32 obsOctetCount; 00771 // the higher sequence number seen from this source 00772 uint16 maxSeqNum; 00773 uint32 extendedMaxSeqNum; 00774 uint32 cumulativePacketLost; 00775 uint8 fractionLost; 00776 // for interarrivel jitter computation 00777 uint32 lastPacketTransitTime; 00778 // interarrival jitter of packets from this source. 00779 float jitter; 00780 uint32 initialDataTimestamp; 00781 timeval initialDataTime; 00782 00783 // this flag assures we only call one gotHello and one 00784 // gotGoodbye for this src. 00785 bool flag; 00786 00787 // for source validation: 00788 uint32 badSeqNum; 00789 uint8 probation; // packets in sequence before valid. 00790 uint16 baseSeqNum; 00791 uint32 expectedPrior; 00792 uint32 receivedPrior; 00793 uint32 seqNumAccum; 00794 }; 00795 00800 bool 00801 isRegistered(uint32 ssrc); 00802 00811 SyncSourceLink* 00812 getSourceBySSRC(uint32 ssrc, bool& created); 00813 00824 bool 00825 BYESource(uint32 ssrc); 00826 00834 bool 00835 removeSource(uint32 ssrc); 00836 00837 inline SyncSourceLink* getFirst() 00838 { return first; } 00839 00840 inline SyncSourceLink* getLast() 00841 { return last; } 00842 00843 inline uint32 00844 getMembersCount() 00845 { return Members::getMembersCount(); } 00846 00847 inline void 00848 setMembersCount(uint32 n) 00849 { Members::setMembersCount(n); } 00850 00851 inline uint32 00852 getSendersCount() 00853 { return Members::getSendersCount(); } 00854 00855 static const size_t defaultMembersHashSize; 00856 static const uint32 SEQNUMMOD; 00857 00858 private: 00859 MembershipBookkeeping(const MembershipBookkeeping &o); 00860 00861 MembershipBookkeeping& 00862 operator=(const MembershipBookkeeping &o); 00863 00868 void 00869 endMembers(); 00870 00871 // Hash table with sources of RTP and RTCP packets 00872 uint32 sourceBucketsNum; 00873 SyncSourceLink** sourceLinks; 00874 // List of sources, ordered from older to newer 00875 SyncSourceLink* first, * last; 00876 }; 00877 00884 class __EXPORT IncomingDataQueue: public IncomingDataQueueBase, 00885 protected MembershipBookkeeping 00886 { 00887 public: 00893 class SyncSourcesIterator 00894 { 00895 public: 00896 typedef std::forward_iterator_tag iterator_category; 00897 typedef SyncSource value_type; 00898 typedef std::ptrdiff_t difference_type; 00899 typedef const SyncSource* pointer; 00900 typedef const SyncSource& reference; 00901 00902 SyncSourcesIterator(SyncSourceLink* l = NULL) : 00903 link(l) 00904 { } 00905 00906 SyncSourcesIterator(const SyncSourcesIterator& si) : 00907 link(si.link) 00908 { } 00909 00910 reference operator*() const 00911 { return *(link->getSource()); } 00912 00913 pointer operator->() const 00914 { return link->getSource(); } 00915 00916 SyncSourcesIterator& operator++() { 00917 link = link->getNext(); 00918 return *this; 00919 } 00920 00921 SyncSourcesIterator operator++(int) { 00922 SyncSourcesIterator result(*this); 00923 ++(*this); 00924 return result; 00925 } 00926 00927 friend bool operator==(const SyncSourcesIterator& l, 00928 const SyncSourcesIterator& r) 00929 { return l.link == r.link; } 00930 00931 friend bool operator!=(const SyncSourcesIterator& l, 00932 const SyncSourcesIterator& r) 00933 { return l.link != r.link; } 00934 00935 private: 00936 SyncSourceLink *link; 00937 }; 00938 00939 SyncSourcesIterator begin() 00940 { return SyncSourcesIterator(MembershipBookkeeping::getFirst()); } 00941 00942 SyncSourcesIterator end() 00943 { return SyncSourcesIterator(NULL); } 00944 00954 const AppDataUnit* 00955 getData(uint32 stamp, const SyncSource* src = NULL); 00956 00957 00964 bool 00965 isWaiting(const SyncSource* src = NULL) const; 00966 00973 uint32 00974 getFirstTimestamp(const SyncSource* src = NULL) const; 00975 00998 void 00999 setMinValidPacketSequence(uint8 packets) 01000 { minValidPacketSequence = packets; } 01001 01002 uint8 01003 getDefaultMinValidPacketSequence() const 01004 { return defaultMinValidPacketSequence; } 01005 01010 uint8 01011 getMinValidPacketSequence() const 01012 { return minValidPacketSequence; } 01013 01014 void 01015 setMaxPacketMisorder(uint16 packets) 01016 { maxPacketMisorder = packets; } 01017 01018 uint16 01019 getDefaultMaxPacketMisorder() const 01020 { return defaultMaxPacketMisorder; } 01021 01022 uint16 01023 getMaxPacketMisorder() const 01024 { return maxPacketMisorder; } 01025 01031 void 01032 setMaxPacketDropout(uint16 packets) // default: 3000. 01033 { maxPacketDropout = packets; } 01034 01035 uint16 01036 getDefaultMaxPacketDropout() const 01037 { return defaultMaxPacketDropout; } 01038 01039 uint16 01040 getMaxPacketDropout() const 01041 { return maxPacketDropout; } 01042 01043 // default value for constructors that allow to specify 01044 // members table s\ize 01045 inline static size_t 01046 getDefaultMembersSize() 01047 { return defaultMembersSize; } 01048 01057 void 01058 setInQueueCryptoContext(CryptoContext* cc); 01059 01070 void 01071 removeInQueueCryptoContext(CryptoContext* cc); 01072 01080 CryptoContext* 01081 getInQueueCryptoContext(uint32 ssrc); 01082 01083 protected: 01087 IncomingDataQueue(uint32 size); 01088 01089 virtual ~IncomingDataQueue() 01090 { } 01091 01104 bool checkSSRCInIncomingRTPPkt(SyncSourceLink& sourceLink, 01105 bool is_new, InetAddress& na, 01106 tpport_t tp); 01107 01123 void setSourceExpirationPeriod(uint8 intervals) 01124 { sourceExpirationPeriod = intervals; } 01125 01132 virtual size_t 01133 takeInDataPacket(); 01134 01135 void renewLocalSSRC(); 01136 01146 IncomingDataQueue::IncomingRTPPktLink* 01147 getWaiting(uint32 timestamp, const SyncSource *src = NULL); 01148 01164 bool 01165 recordReception(SyncSourceLink& srcLink, const IncomingRTPPkt& pkt, 01166 const timeval recvtime); 01167 01174 void 01175 recordExtraction(const IncomingRTPPkt& pkt); 01176 01177 void purgeIncomingQueue(); 01178 01185 inline virtual void 01186 onNewSyncSource(const SyncSource&) 01187 { } 01188 01189 protected: 01206 inline virtual bool 01207 onRTPPacketRecv(IncomingRTPPkt&) 01208 { return true; } 01209 01218 inline virtual void onExpireRecv(IncomingRTPPkt&) 01219 { return; } 01220 01234 inline virtual bool 01235 onSRTPPacketError(IncomingRTPPkt& pkt, int32 errorCode) 01236 { return false; } 01237 01238 inline virtual bool 01239 end2EndDelayed(IncomingRTPPktLink&) 01240 { return false; } 01241 01257 bool 01258 insertRecvPacket(IncomingRTPPktLink* packetLink); 01259 01271 virtual size_t 01272 recvData(unsigned char* buffer, size_t length, 01273 InetHostAddress& host, tpport_t& port) = 0; 01274 01275 virtual size_t 01276 getNextDataPacketSize() const = 0; 01277 01278 mutable ThreadLock recvLock; 01279 // reception queue 01280 IncomingRTPPktLink* recvFirst, * recvLast; 01281 // values for packet validation. 01282 static const uint8 defaultMinValidPacketSequence; 01283 static const uint16 defaultMaxPacketMisorder; 01284 static const uint16 defaultMaxPacketDropout; 01285 uint8 minValidPacketSequence; 01286 uint16 maxPacketMisorder; 01287 uint16 maxPacketDropout; 01288 static const size_t defaultMembersSize; 01289 uint8 sourceExpirationPeriod; 01290 mutable Mutex cryptoMutex; 01291 std::list<CryptoContext *> cryptoContexts; 01292 }; 01293 // iqueue 01295 01296 END_NAMESPACE 01297 01298 #endif //CCXX_RTP_IQUEUE_H_ 01299