📄 cqueue.h
字号:
QueueRTCPManager& operator=(const QueueRTCPManager &o); /** * Posting of RTCP messages. * * @return std::size_t number of octets sent */ size_t dispatchControlPacket(); /** * For picking up incoming RTCP packets if they are waiting. A * timeout for the maximum interval since the last RTCP packet * had been received is also returned. This is checked every * rtcpCheckInterval seconds. * * This method decomposes all incoming RTCP compound packets * pending in the control socket and processes each RTCP * packet. * **/ void takeInControlPacket(); /** * Computes the interval for sending RTCP compound packets, * based on the average size of RTCP packets sent and * received, and the current estimated number of participants * in the session. * * @note This currently follows the rules in section 6 of * RFC 3550 * @todo make it more flexible as recommended in the draft. For now, * we have setMinRTCPInterval. * * @return interval for sending RTCP compound packets **/ virtual timeval computeRTCPInterval(); /** * Choose which should be the type of the next SDES item * sent. This method is called when packing SDES chunks in a * new RTCP packet. * * @return type of the next SDES item to be sent **/ virtual SDESItemType scheduleSDESItem(); /** * Plug-in for SSRC collision handling. * * @param - previously identified source. **/ inline virtual void onSSRCCollision(const SyncSource&) { } /** * Virtual reimplemented from RTPDataQueue **/ virtual bool end2EndDelayed(IncomingRTPPktLink& p); /** * Plug-in for processing of SR/RR RTCP packet * profile-specific extensions (third part of SR reports or * second part of RR reports). * * @param - Content of the profile extension. * @param - Length of the extension, in octets. **/ inline virtual void onGotRRSRExtension(unsigned char*, size_t) { return; } /** * A plugin point for goodbye message. Called when a BYE RTCP * packet has been received from a valid synchronization * source. * * @param - synchronization source from what a BYE RTCP * packet has been just received. * @param - reason string the source has provided. **/ inline virtual void onGotGoodbye(const SyncSource&, const std::string&) { return; } /** * Process a BYE packet just received and identified. * * @param pkt previously identified RTCP BYE packet * @param pointer octet number in the RTCP reception buffer * where the packet is stored * @param len total length of the compount RTCP packet the BYE * packet to process is contained * * @bug if the bye packet contains several SSRCs, * eventSourceLeaving is only called for the last one **/ bool getBYE(RTCPPacket &pkt, size_t &pointer, size_t len); /** * @return number of Report Blocks packed **/ uint8 packReportBlocks(RRBlock* blocks, uint16& len, uint16& available); /** * Builds an SDES RTCP packet. Each chunk is built following * appendix A.4 in draft-ietf-avt-rtp-new. * * @param len provisionary length of the RTCP compound packet * * @return **/ void packSDES(uint16& len); /** * This must be called in order to update the average RTCP compound * packet size estimation when: * * a compoung RTCP packet is received (6.3.3). * * a compound RTCP packet is transmitted (6.3.6). * * @param len length in octets of the compound RTCP packet * just received/transmitted. **/ void updateAvgRTCPSize(size_t len); /** * Apply reverse reconsideration adjustment to timing * parameters when receiving BYE packets and not waiting to * send a BYE. **/ void reverseReconsideration(); bool timerReconsideration(); /** * Purge sources that do not seem active any more. * * @note MUST be perform at least every RTCP transmission * interval * @todo implement it. It may be dangerous and anyway should * be optional. **/ void expireSSRCs(); /** * To be executed when whe are leaving the session. **/ void getOnlyBye(); /** * Set item value from a string without null termination (as * it is transported in RTCP packets). **/ void setSDESItem(Participant* part, SDESItemType type, const char* const value, size_t len); /** * Set PRIV item previx value from a string without null * termination (as it is transported in RTCP packets). **/ void setPRIVPrefix(Participant* part, const char* const value, size_t len); /** * For certain control calculations in RTCP, the size of the * underlying network and transport protocols is needed. This * method provides the size of the network level header for * the default case of IP (20 octets). In case other protocol * with different header size is used, this method should be * redefined in a new specialized class. * * @return size of the headers of the network level. IP (20) by * default. **/ inline virtual uint16 networkHeaderSize() { return 20; } /** * For certain control calculations in RTCP, the size of the * underlying network and transport protocols is needed. This * method provides the size of the transport level header for * the default case of UDP (8 octets). In case other protocol * with different header size is used, this method should be * redefined in a new specialized class. * * return size of the headers of the transport level. UDP (8) * by default **/ inline virtual uint16 transportHeaderSize() { return 8; } SDESItemType nextSDESType(SDESItemType t); virtual size_t sendControl(const unsigned char* const buffer, size_t len) = 0; virtual size_t recvControl(unsigned char* buffer, size_t len, InetHostAddress& na, tpport_t& tp) = 0; virtual bool isPendingControl(microtimeout_t timeout) = 0; // whether the RTCP service is active volatile bool controlServiceActive; float controlBwFract, sendControlBwFract, recvControlBwFract; // number of RTCP packets sent since the beginning uint32 ctrlSendCount; // Network + transport headers size, typically size of IP + // UDP headers uint16 lowerHeadersSize; SDESItemType nextScheduledSDESItem; static const SDESItemType firstSchedulable; static const SDESItemType lastSchedulable; // state for rtcp timing. Its meaning is defined in // draft-ietf-avt-rtp-new, 6.3. // Parameters for timer reconsideration algorithm struct { timeval rtcpTp, rtcpTc, rtcpTn; uint32 rtcpPMembers; } reconsInfo; bool rtcpWeSent; uint16 rtcpAvgSize; bool rtcpInitial; // last time we checked if there were incoming RTCP packets timeval rtcpLastCheck; // interval to check if there are incoming RTCP packets timeval rtcpCheckInterval; // next time to check if there are incoming RTCP packets timeval rtcpNextCheck; // number of RTP data packets sent at the time of the last // RTCP packet transmission. uint32 lastSendPacketCount; // minimum interval for transmission of RTCP packets. The // result of computeRTCPInterval will always be >= (times a // random number between 0.5 and 1.5). microtimeout_t rtcpMinInterval; microtimeout_t leavingDelay; static const microtimeout_t defaultEnd2EndDelay; // Maximum delay allowed between packet timestamping and // packet availability for the application. microtimeout_t end2EndDelay; // Application this queue is bound to. RTPApplication& queueApplication; // an empty RTPData static const uint16 TIMEOUT_MULTIPLIER; static const double RECONSIDERATION_COMPENSATION;};/** * This class, an RTP/RTCP queue, adds audio/video profile (AVP) * specific methods to the generic RTCP service queue * (QueueRTCPManager). * * @author Federico Montesino Pouzols <fedemp@altern.org> **/class AVPQueue : public QueueRTCPManager{public: /** * Specify the bandwith available for control (RTCP) packets. * This method sets the global control bandwidth for both * sender and receiver reports. As recommended in RFC 1890, * 1/4 of the total control bandwidth is dedicated to senders, * whereas 3/4 are dedicated to receivers. * * @param fraction fraction of the session bandwidth, between * 0 and 1 * * @note If this method is not called, it is assumed that the * control bandwidth is equal to 5% of the session * bandwidth. Note also that the RFC RECOMMENDS the 5%. * **/ inline void setControlBandwidth(float fraction) { QueueRTCPManager::setControlBandwidth(fraction); } float getControlBandwidth() const { return QueueRTCPManager::getControlBandwidth(); }protected: AVPQueue(uint32 size = RTPDataQueue::defaultMembersHashSize, RTPApplication& app = defaultApplication()) : QueueRTCPManager(size,app) { } /** * Local SSRC is given instead of computed by the queue. **/ AVPQueue(uint32 ssrc, uint32 size = RTPDataQueue::defaultMembersHashSize, RTPApplication& app = defaultApplication()) : QueueRTCPManager(ssrc,size,app) { } inline virtual ~AVPQueue() { }};/** @}*/ // cqueue#ifdef CCXX_NAMESPACES}#endif#endif //CCXX_RTP_CQUEUE_H_/** EMACS ** * Local variables: * mode: c++ * c-basic-offset: 8 * End: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -