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 00053 #ifdef CCXX_NAMESPACES 00054 using namespace std; 00055 namespace ost { 00056 #endif 00057 00072 class __EXPORT Members 00073 { 00074 public: 00075 inline void 00076 setMembersCount(uint32 n) 00077 { members = n; } 00078 00079 inline void 00080 increaseMembersCount() 00081 { members++; } 00082 00083 inline void 00084 decreaseMembersCount() 00085 { members--; } 00086 00087 inline uint32 00088 getMembersCount() const 00089 { return members; } 00090 00091 inline void 00092 setSendersCount(uint32 n) 00093 { activeSenders = n; } 00094 00095 inline void 00096 increaseSendersCount() 00097 { activeSenders++; } 00098 00099 inline void 00100 decreaseSendersCount() 00101 { activeSenders--; } 00102 00103 inline uint32 00104 getSendersCount() const 00105 { return activeSenders; } 00106 00107 protected: 00108 Members() : 00109 members(0), 00110 activeSenders(0) 00111 { } 00112 00113 inline virtual ~Members() 00114 { } 00115 00116 private: 00118 uint32 members; 00120 uint32 activeSenders; 00121 }; 00122 00129 class __EXPORT SyncSourceHandler 00130 { 00131 public: 00138 inline void* 00139 getLink(const SyncSource& source) const 00140 { return source.getLink(); } 00141 00142 inline void 00143 setLink(SyncSource& source, void* link) 00144 { source.setLink(link); } 00145 00146 inline void 00147 setParticipant(SyncSource& source, Participant& p) 00148 { source.setParticipant(p); } 00149 00150 inline void 00151 setState(SyncSource& source, SyncSource::State ns) 00152 { source.setState(ns); } 00153 00154 inline void 00155 setSender(SyncSource& source, bool active) 00156 { source.setSender(active); } 00157 00158 inline void 00159 setDataTransportPort(SyncSource& source, tpport_t p) 00160 { source.setDataTransportPort(p); } 00161 00162 inline void 00163 setControlTransportPort(SyncSource& source, tpport_t p) 00164 { source.setControlTransportPort(p); } 00165 00166 inline void 00167 setNetworkAddress(SyncSource& source, InetAddress addr) 00168 { source.setNetworkAddress(addr); } 00169 00170 protected: 00171 SyncSourceHandler() 00172 { } 00173 00174 inline virtual ~SyncSourceHandler() 00175 { } 00176 }; 00177 00184 class __EXPORT ParticipantHandler 00185 { 00186 public: 00187 inline void 00188 setSDESItem(Participant* part, SDESItemType item, 00189 const std::string& val) 00190 { part->setSDESItem(item,val); } 00191 00192 inline void 00193 setPRIVPrefix(Participant* part, const std::string val) 00194 { part->setPRIVPrefix(val); } 00195 00196 protected: 00197 ParticipantHandler() 00198 { } 00199 00200 inline virtual ~ParticipantHandler() 00201 { } 00202 }; 00203 00210 class __EXPORT ApplicationHandler 00211 { 00212 public: 00213 inline void 00214 addParticipant(RTPApplication& app, Participant& part) 00215 { app.addParticipant(part); } 00216 00217 inline void 00218 removeParticipant(RTPApplication& app, 00219 RTPApplication::ParticipantLink* pl) 00220 { app.removeParticipant(pl); } 00221 00222 protected: 00223 ApplicationHandler() 00224 { } 00225 00226 inline virtual ~ApplicationHandler() 00227 { } 00228 }; 00229 00237 class __EXPORT ConflictHandler 00238 { 00239 public: 00240 struct ConflictingTransportAddress 00241 { 00242 ConflictingTransportAddress(InetAddress na, 00243 tpport_t dtp, tpport_t ctp); 00244 00245 void setNext(ConflictingTransportAddress* nc) 00246 { next = nc; } 00247 00248 inline const InetAddress& getNetworkAddress( ) const 00249 { return networkAddress; } 00250 00251 inline tpport_t getDataTransportPort() const 00252 { return dataTransportPort; } 00253 00254 inline tpport_t getControlTransportPort() const 00255 { return controlTransportPort; } 00256 00257 InetAddress networkAddress; 00258 tpport_t dataTransportPort; 00259 tpport_t controlTransportPort; 00260 ConflictingTransportAddress* next; 00261 // arrival time of last data or control packet. 00262 timeval lastPacketTime; 00263 }; 00264 00269 ConflictingTransportAddress* searchDataConflict(InetAddress na, 00270 tpport_t dtp); 00275 ConflictingTransportAddress* searchControlConflict(InetAddress na, 00276 tpport_t ctp); 00277 00278 void updateConflict(ConflictingTransportAddress& ca) 00279 { gettimeofday(&(ca.lastPacketTime),NULL); } 00280 00281 void addConflict(const InetAddress& na, tpport_t dtp, tpport_t ctp); 00282 00283 protected: 00284 ConflictHandler() 00285 { firstConflict = lastConflict = NULL; } 00286 00287 inline virtual ~ConflictHandler() 00288 { } 00289 00290 ConflictingTransportAddress* firstConflict, * lastConflict; 00291 }; 00292 00303 class __EXPORT MembershipBookkeeping : 00304 public SyncSourceHandler, 00305 public ParticipantHandler, 00306 public ApplicationHandler, 00307 public ConflictHandler, 00308 private Members 00309 { 00310 public: 00311 inline size_t getDefaultMembersHashSize() 00312 { return defaultMembersHashSize; } 00313 00314 protected: 00315 00329 MembershipBookkeeping(uint32 initialSize = defaultMembersHashSize); 00330 00335 inline virtual 00336 ~MembershipBookkeeping() 00337 { endMembers(); } 00338 00339 struct SyncSourceLink; 00340 00341 inline SyncSourceLink* getLink(const SyncSource& source) const 00342 { return static_cast<SyncSourceLink*>(SyncSourceHandler::getLink(source)); } 00347 inline bool isMine(const SyncSource& source) const 00348 { return getLink(source)->getMembership() == this; } 00349 00356 struct IncomingRTPPktLink 00357 { 00358 IncomingRTPPktLink(IncomingRTPPkt* pkt, SyncSourceLink* sLink, 00359 struct timeval& recv_ts, 00360 uint32 shifted_ts, 00361 IncomingRTPPktLink* sp, 00362 IncomingRTPPktLink* sn, 00363 IncomingRTPPktLink* p, 00364 IncomingRTPPktLink* n) : 00365 packet(pkt), 00366 sourceLink(sLink), 00367 prev(p), next(n), 00368 srcPrev(sp), srcNext(sn), 00369 receptionTime(recv_ts), 00370 shiftedTimestamp(shifted_ts) 00371 { } 00372 00373 ~IncomingRTPPktLink() 00374 { } 00375 00376 inline SyncSourceLink* getSourceLink() const 00377 { return sourceLink; } 00378 00379 inline void setSourceLink(SyncSourceLink* src) 00380 { sourceLink = src; } 00381 00382 inline IncomingRTPPktLink* getNext() const 00383 { return next; } 00384 00385 inline void setNext(IncomingRTPPktLink* nl) 00386 { next = nl; } 00387 00388 inline IncomingRTPPktLink* getPrev() const 00389 { return prev; } 00390 00391 inline void setPrev(IncomingRTPPktLink* pl) 00392 { prev = pl; } 00393 00394 inline IncomingRTPPktLink* getSrcNext() const 00395 { return srcNext; } 00396 00397 inline void setSrcNext(IncomingRTPPktLink* sn) 00398 { srcNext = sn; } 00399 00400 inline IncomingRTPPktLink* getSrcPrev() const 00401 { return srcPrev; } 00402 00403 inline void setSrcPrev(IncomingRTPPktLink* sp) 00404 { srcPrev = sp; } 00405 00406 inline IncomingRTPPkt* getPacket() const 00407 { return packet; } 00408 00409 inline void setPacket(IncomingRTPPkt* pkt) 00410 { packet = pkt; } 00411 00419 inline void setRecvTime(const timeval &t) 00420 { receptionTime = t; } 00421 00425 inline timeval getRecvTime() const 00426 { return receptionTime; } 00427 00436 inline uint32 getTimestamp() const 00437 { return shiftedTimestamp; } 00438 00439 inline void setTimestamp(uint32 ts) 00440 { shiftedTimestamp = ts;} 00441 00442 // the packet this link refers to. 00443 IncomingRTPPkt* packet; 00444 // the synchronization source this packet comes from. 00445 SyncSourceLink* sourceLink; 00446 // global incoming packet queue links. 00447 IncomingRTPPktLink* prev, * next; 00448 // source specific incoming packet queue links. 00449 IncomingRTPPktLink* srcPrev, * srcNext; 00450 // time this packet was received at 00451 struct timeval receptionTime; 00452 // timestamp of the packet in host order and after 00453 // substracting the initial timestamp for its source 00454 // (it is an increment from the initial timestamp). 00455 uint32 shiftedTimestamp; 00456 }; 00457 00474 struct SyncSourceLink 00475 { 00476 // 2^16 00477 static const uint32 SEQNUMMOD; 00478 00479 SyncSourceLink(MembershipBookkeeping* m, 00480 SyncSource* s, 00481 IncomingRTPPktLink* fp = NULL, 00482 IncomingRTPPktLink* lp = NULL, 00483 SyncSourceLink* ps = NULL, 00484 SyncSourceLink* ns = NULL, 00485 SyncSourceLink* ncollis = NULL) : 00486 membership(m), source(s), first(fp), last(lp), 00487 prev(ps), next(ns), nextCollis(ncollis), 00488 prevConflict(NULL) 00489 { m->setLink(*s,this); // record that the source is associated 00490 initStats(); // to this link. 00491 } 00492 00496 ~SyncSourceLink(); 00497 00498 inline MembershipBookkeeping* getMembership() 00499 { return membership; } 00500 00505 inline SyncSource* getSource() { return source; } 00506 00511 inline IncomingRTPPktLink* getFirst() 00512 { return first; } 00513 00514 inline void setFirst(IncomingRTPPktLink* fp) 00515 { first = fp; } 00516 00521 inline IncomingRTPPktLink* getLast() 00522 { return last; } 00523 00524 inline void setLast(IncomingRTPPktLink* lp) 00525 { last = lp; } 00526 00530 inline SyncSourceLink* getPrev() 00531 { return prev; } 00532 00533 inline void setPrev(SyncSourceLink* ps) 00534 { prev = ps; } 00535 00539 inline SyncSourceLink* getNext() 00540 { return next; } 00541 00542 inline void setNext(SyncSourceLink *ns) 00543 { next = ns; } 00544 00551 inline SyncSourceLink* getNextCollis() 00552 { return nextCollis; } 00553 00554 inline void setNextCollis(SyncSourceLink* ns) 00555 { nextCollis = ns; } 00556 00557 inline ConflictingTransportAddress* getPrevConflict() const 00558 { return prevConflict; } 00559 00563 void setPrevConflict(InetAddress& addr, tpport_t dataPort, 00564 tpport_t controlPort); 00565 00566 unsigned char* getSenderInfo() 00567 { return senderInfo; } 00568 00569 void setSenderInfo(unsigned char* si); 00570 00571 unsigned char* getReceiverInfo() 00572 { return receiverInfo; } 00573 00574 void setReceiverInfo(unsigned char* ri); 00575 00576 inline timeval getLastPacketTime() const 00577 { return lastPacketTime; } 00578 00579 inline timeval getLastRTCPPacketTime() const 00580 { return lastRTCPPacketTime; } 00581 00582 inline timeval getLastRTCPSRTime() const 00583 { return lastRTCPSRTime; } 00584 00589 inline uint32 getObservedPacketCount() const 00590 { return obsPacketCount; } 00591 00592 inline void incObservedPacketCount() 00593 { obsPacketCount++; } 00594 00599 inline uint32 getObservedOctetCount() const 00600 { return obsOctetCount; } 00601 00602 inline void incObservedOctetCount(uint32 n) 00603 { obsOctetCount += n; } 00604 00608 uint16 00609 getMaxSeqNum() const 00610 { return maxSeqNum; } 00611 00616 void 00617 setMaxSeqNum(uint16 max) 00618 { maxSeqNum = max; } 00619 00620 inline uint32 00621 getExtendedMaxSeqNum() const 00622 { return extendedMaxSeqNum; } 00623 00624 inline void 00625 setExtendedMaxSeqNum(uint32 seq) 00626 { extendedMaxSeqNum = seq; } 00627 00628 inline uint32 getCumulativePacketLost() const 00629 { return cumulativePacketLost; } 00630 00631 inline void setCumulativePacketLost(uint32 pl) 00632 { cumulativePacketLost = pl; } 00633 00634 inline uint8 getFractionLost() const 00635 { return fractionLost; } 00636 00637 inline void setFractionLost(uint8 fl) 00638 { fractionLost = fl; } 00639 00640 inline uint32 getLastPacketTransitTime() 00641 { return lastPacketTransitTime; } 00642 00643 inline void setLastPacketTransitTime(uint32 time) 00644 { lastPacketTransitTime = time; } 00645 00646 inline float getJitter() const 00647 { return jitter; } 00648 00649 inline void setJitter(float j) 00650 { jitter = j; } 00651 00652 inline uint32 getInitialDataTimestamp() const 00653 { return initialDataTimestamp; } 00654 00655 inline void setInitialDataTimestamp(uint32 ts) 00656 { initialDataTimestamp = ts; } 00657 00658 inline timeval getInitialDataTime() const 00659 { return initialDataTime; } 00660 00661 inline void setInitialDataTime(timeval it) 00662 { initialDataTime = it; } 00663 00671 bool getGoodbye() 00672 { 00673 if(!flag) 00674 return false; 00675 flag = false; 00676 return true; 00677 } 00678 00685 bool getHello() { 00686 if(flag) 00687 return false; 00688 flag = true; 00689 return true; 00690 } 00691 00692 inline uint32 getBadSeqNum() const 00693 { return badSeqNum; } 00694 00695 inline void setBadSeqNum(uint32 seq) 00696 { badSeqNum = seq; } 00697 00698 uint8 getProbation() const 00699 { return probation; } 00700 00701 inline void setProbation(uint8 p) 00702 { probation = p; } 00703 00704 inline void decProbation() 00705 { --probation; } 00706 00707 bool isValid() const 00708 { return 0 == probation; } 00709 00710 inline uint16 getBaseSeqNum() const 00711 { return baseSeqNum; } 00712 00713 inline uint32 getSeqNumAccum() const 00714 { return seqNumAccum; } 00715 00716 inline void incSeqNumAccum() 00717 { seqNumAccum += SEQNUMMOD; } 00718 00722 inline void initSequence(uint16 seqnum) 00723 { maxSeqNum = seqNumAccum = seqnum; } 00724 00735 void recordInsertion(const IncomingRTPPktLink& pl); 00736 00737 void initStats(); 00738 00743 void computeStats(); 00744 00745 MembershipBookkeeping* membership; 00746 // The source this link object refers to. 00747 SyncSource* source; 00748 // first/last packets from this source in the queue. 00749 IncomingRTPPktLink* first, * last; 00750 // Links for synchronization sources located before 00751 // and after this one in the list of sources. 00752 SyncSourceLink* prev, * next; 00753 // Prev and next inside the hash table collision list. 00754 SyncSourceLink* nextCollis; 00755 ConflictingTransportAddress* prevConflict; 00756 unsigned char* senderInfo; 00757 unsigned char* receiverInfo; 00758 // time the last RTP packet from this source was 00759 // received at. 00760 timeval lastPacketTime; 00761 // time the last RTCP packet was received. 00762 timeval lastRTCPPacketTime; 00763 // time the lasrt RTCP SR was received. Required for 00764 // DLSR computation. 00765 timeval lastRTCPSRTime; 00766 00767 // for outgoing RR reports. 00768 // number of packets received from this source. 00769 uint32 obsPacketCount; 00770 // number of octets received from this source. 00771 uint32 obsOctetCount; 00772 // the higher sequence number seen from this source 00773 uint16 maxSeqNum; 00774 uint32 extendedMaxSeqNum; 00775 uint32 cumulativePacketLost; 00776 uint8 fractionLost; 00777 // for interarrivel jitter computation 00778 uint32 lastPacketTransitTime; 00779 // interarrival jitter of packets from this source. 00780 float jitter; 00781 uint32 initialDataTimestamp; 00782 timeval initialDataTime; 00783 00784 // this flag assures we only call one gotHello and one 00785 // gotGoodbye for this src. 00786 bool flag; 00787 00788 // for source validation: 00789 uint32 badSeqNum; 00790 uint8 probation; // packets in sequence before valid. 00791 uint16 baseSeqNum; 00792 uint32 expectedPrior; 00793 uint32 receivedPrior; 00794 uint32 seqNumAccum; 00795 }; 00796 00801 bool 00802 isRegistered(uint32 ssrc); 00803 00812 SyncSourceLink* 00813 getSourceBySSRC(uint32 ssrc, bool& created); 00814 00825 bool 00826 BYESource(uint32 ssrc); 00827 00835 bool 00836 removeSource(uint32 ssrc); 00837 00838 inline SyncSourceLink* getFirst() 00839 { return first; } 00840 00841 inline SyncSourceLink* getLast() 00842 { return last; } 00843 00844 inline uint32 00845 getMembersCount() 00846 { return Members::getMembersCount(); } 00847 00848 inline void 00849 setMembersCount(uint32 n) 00850 { Members::setMembersCount(n); } 00851 00852 inline uint32 00853 getSendersCount() 00854 { return Members::getSendersCount(); } 00855 00856 static const size_t defaultMembersHashSize; 00857 static const uint32 SEQNUMMOD; 00858 00859 private: 00860 MembershipBookkeeping(const MembershipBookkeeping &o); 00861 00862 MembershipBookkeeping& 00863 operator=(const MembershipBookkeeping &o); 00864 00869 void 00870 endMembers(); 00871 00872 // Hash table with sources of RTP and RTCP packets 00873 uint32 sourceBucketsNum; 00874 SyncSourceLink** sourceLinks; 00875 // List of sources, ordered from older to newer 00876 SyncSourceLink* first, * last; 00877 }; 00878 00885 class __EXPORT IncomingDataQueue: public IncomingDataQueueBase, 00886 protected MembershipBookkeeping 00887 { 00888 public: 00894 class SyncSourcesIterator 00895 { 00896 public: 00897 typedef std::forward_iterator_tag iterator_category; 00898 typedef SyncSource value_type; 00899 typedef ptrdiff_t difference_type; 00900 typedef const SyncSource* pointer; 00901 typedef const SyncSource& reference; 00902 00903 SyncSourcesIterator(SyncSourceLink* l = NULL) : 00904 link(l) 00905 { } 00906 00907 SyncSourcesIterator(const SyncSourcesIterator& si) : 00908 link(si.link) 00909 { } 00910 00911 reference operator*() const 00912 { return *(link->getSource()); } 00913 00914 pointer operator->() const 00915 { return link->getSource(); } 00916 00917 SyncSourcesIterator& operator++() { 00918 link = link->getNext(); 00919 return *this; 00920 } 00921 00922 SyncSourcesIterator operator++(int) { 00923 SyncSourcesIterator result(*this); 00924 ++(*this); 00925 return result; 00926 } 00927 00928 friend bool operator==(const SyncSourcesIterator& l, 00929 const SyncSourcesIterator& r) 00930 { return l.link == r.link; } 00931 00932 friend bool operator!=(const SyncSourcesIterator& l, 00933 const SyncSourcesIterator& r) 00934 { return l.link != r.link; } 00935 00936 private: 00937 SyncSourceLink *link; 00938 }; 00939 00940 SyncSourcesIterator begin() 00941 { return SyncSourcesIterator(MembershipBookkeeping::getFirst()); } 00942 00943 SyncSourcesIterator end() 00944 { return SyncSourcesIterator(NULL); } 00945 00955 const AppDataUnit* 00956 getData(uint32 stamp, const SyncSource* src = NULL); 00957 00958 00965 bool 00966 isWaiting(const SyncSource* src = NULL) const; 00967 00974 uint32 00975 getFirstTimestamp(const SyncSource* src = NULL) const; 00976 00999 void 01000 setMinValidPacketSequence(uint8 packets) 01001 { minValidPacketSequence = packets; } 01002 01003 uint8 01004 getDefaultMinValidPacketSequence() const 01005 { return defaultMinValidPacketSequence; } 01006 01011 uint8 01012 getMinValidPacketSequence() const 01013 { return minValidPacketSequence; } 01014 01015 void 01016 setMaxPacketMisorder(uint16 packets) 01017 { maxPacketMisorder = packets; } 01018 01019 uint16 01020 getDefaultMaxPacketMisorder() const 01021 { return defaultMaxPacketMisorder; } 01022 01023 uint16 01024 getMaxPacketMisorder() const 01025 { return maxPacketMisorder; } 01026 01032 void 01033 setMaxPacketDropout(uint16 packets) // default: 3000. 01034 { maxPacketDropout = packets; } 01035 01036 uint16 01037 getDefaultMaxPacketDropout() const 01038 { return defaultMaxPacketDropout; } 01039 01040 uint16 01041 getMaxPacketDropout() const 01042 { return maxPacketDropout; } 01043 01044 // default value for constructors that allow to specify 01045 // members table s\ize 01046 inline static size_t 01047 getDefaultMembersSize() 01048 { return defaultMembersSize; } 01049 01058 void 01059 setInQueueCryptoContext(CryptoContext* cc); 01060 01071 void 01072 removeInQueueCryptoContext(CryptoContext* cc); 01073 01081 CryptoContext* 01082 getInQueueCryptoContext(uint32 ssrc); 01083 01084 protected: 01088 IncomingDataQueue(uint32 size); 01089 01090 virtual ~IncomingDataQueue() 01091 { } 01092 01105 bool checkSSRCInIncomingRTPPkt(SyncSourceLink& sourceLink, 01106 bool is_new, InetAddress& na, 01107 tpport_t tp); 01108 01124 void setSourceExpirationPeriod(uint8 intervals) 01125 { sourceExpirationPeriod = intervals; } 01126 01133 virtual size_t 01134 takeInDataPacket(); 01135 01136 void renewLocalSSRC(); 01137 01147 IncomingDataQueue::IncomingRTPPktLink* 01148 getWaiting(uint32 timestamp, const SyncSource *src = NULL); 01149 01165 bool 01166 recordReception(SyncSourceLink& srcLink, const IncomingRTPPkt& pkt, 01167 const timeval recvtime); 01168 01175 void 01176 recordExtraction(const IncomingRTPPkt& pkt); 01177 01178 void purgeIncomingQueue(); 01179 01186 inline virtual void 01187 onNewSyncSource(const SyncSource&) 01188 { } 01189 01190 protected: 01207 inline virtual bool 01208 onRTPPacketRecv(IncomingRTPPkt&) 01209 { return true; } 01210 01219 inline virtual void onExpireRecv(IncomingRTPPkt&) 01220 { return; } 01221 01235 inline virtual bool 01236 onSRTPPacketError(IncomingRTPPkt& pkt, int32 errorCode) 01237 { return false; } 01238 01239 inline virtual bool 01240 end2EndDelayed(IncomingRTPPktLink&) 01241 { return false; } 01242 01258 bool 01259 insertRecvPacket(IncomingRTPPktLink* packetLink); 01260 01272 virtual size_t 01273 recvData(unsigned char* buffer, size_t length, 01274 InetHostAddress& host, tpport_t& port) = 0; 01275 01276 virtual size_t 01277 getNextDataPacketSize() const = 0; 01278 01279 mutable ThreadLock recvLock; 01280 // reception queue 01281 IncomingRTPPktLink* recvFirst, * recvLast; 01282 // values for packet validation. 01283 static const uint8 defaultMinValidPacketSequence; 01284 static const uint16 defaultMaxPacketMisorder; 01285 static const uint16 defaultMaxPacketDropout; 01286 uint8 minValidPacketSequence; 01287 uint16 maxPacketMisorder; 01288 uint16 maxPacketDropout; 01289 static const size_t defaultMembersSize; 01290 uint8 sourceExpirationPeriod; 01291 mutable Mutex cryptoMutex; 01292 std::list<CryptoContext *> cryptoContexts; 01293 }; 01294 // iqueue 01296 01297 #ifdef CCXX_NAMESPACES 01298 } 01299 #endif 01300 01301 #endif //CCXX_RTP_IQUEUE_H_ 01302