📄 rtpsession.h
字号:
/** Sets the current source to be the first source in the table which has RTPPacket instances * that we haven't extracted yet. * Sets the current source to be the first source in the table which has RTPPacket instances * that we haven't extracted yet. If no such member was found, the function returns \c false, * otherwise it returns \c true. */ bool GotoFirstSourceWithData(); /** Sets the current source to be the next source in the table which has RTPPacket instances * that we haven't extracted yet. * Sets the current source to be the next source in the table which has RTPPacket instances * that we haven't extracted yet. If no such member was found, the function returns \c false, * otherwise it returns \c true. */ bool GotoNextSourceWithData(); /** Sets the current source to be the previous source in the table which has RTPPacket * instances that we haven't extracted yet. * Sets the current source to be the previous source in the table which has RTPPacket * instances that we haven't extracted yet. If no such member was found, the function returns \c false, * otherwise it returns \c true. */ bool GotoPreviousSourceWithData(); /** Returns the \c RTPSourceData instance for the currently selected participant. */ RTPSourceData *GetCurrentSourceInfo(); /** Returns the \c RTPSourceData instance for the participant identified by \c ssrc, * or NULL if no such entry exists. */ RTPSourceData *GetSourceInfo(uint32_t ssrc); /** Extracts the next packet from the received packets queue of the current participant, * or NULL if no more packets are available. * Extracts the next packet from the received packets queue of the current participant, * or NULL if no more packets are available. When the packet is no longer needed, its * memory should be freed using the DeletePacket member function. */ RTPPacket *GetNextPacket(); /** Frees the memory used by \c p. */ void DeletePacket(RTPPacket *p); /** See BeginDataAccess. */ int EndDataAccess(); /** Sets the receive mode to \c m. * Sets the receive mode to \c m. Note that when the receive mode is changed, the list of * addresses to be ignored ot accepted will be cleared. */ int SetReceiveMode(RTPTransmitter::ReceiveMode m); /** Adds \c addr to the list of addresses to ignore. */ int AddToIgnoreList(const RTPAddress &addr); /** Deletes \c addr from the list of addresses to ignore. */ int DeleteFromIgnoreList(const RTPAddress &addr); /** Clears the list of addresses to ignore. */ void ClearIgnoreList(); /** Adds \c addr to the list of addresses to accept. */ int AddToAcceptList(const RTPAddress &addr); /** Deletes \c addr from the list of addresses to accept. */ int DeleteFromAcceptList(const RTPAddress &addr); /** Clears the list of addresses to accept. */ void ClearAcceptList(); /** Sets the maximum allowed packet size to \c s. */ int SetMaximumPacketSize(size_t s); /** Sets the session bandwidth to \c bw, which is specified in bytes per second. */ int SetSessionBandwidth(double bw); /** Sets the timestamp unit for our own data. * Sets the timestamp unit for our own data. The timestamp unit is defined as a time interval in * seconds divided by the corresponding timestamp interval. For example, for 8000 Hz audio, the * timestamp unit would typically be 1/8000. Since this value is initially set to an illegal value, * the user must set this to an allowed value to be able to create a session. */ int SetTimestampUnit(double u); /** Sets the RTCP interval for the SDES name item. * After all possible sources in the source table have been processed, the class will check if other * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count * is positive, an SDES name item will be added after the sources in the source table have been * processed \c count times. */ void SetNameInterval(int count); /** Sets the RTCP interval for the SDES e-mail item. * After all possible sources in the source table have been processed, the class will check if other * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count * is positive, an SDES e-mail item will be added after the sources in the source table have been * processed \c count times. */ void SetEMailInterval(int count); /** Sets the RTCP interval for the SDES location item. * After all possible sources in the source table have been processed, the class will check if other * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count * is positive, an SDES location item will be added after the sources in the source table have been * processed \c count times. */ void SetLocationInterval(int count); /** Sets the RTCP interval for the SDES phone item. * After all possible sources in the source table have been processed, the class will check if other * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count * is positive, an SDES phone item will be added after the sources in the source table have been * processed \c count times. */ void SetPhoneInterval(int count); /** Sets the RTCP interval for the SDES tool item. * After all possible sources in the source table have been processed, the class will check if other * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count * is positive, an SDES tool item will be added after the sources in the source table have been * processed \c count times. */ void SetToolInterval(int count); /** Sets the RTCP interval for the SDES note item. * After all possible sources in the source table have been processed, the class will check if other * SDES items need to be sent. If \c count is zero or negative, nothing will happen. If \c count * is positive, an SDES note item will be added after the sources in the source table have been * processed \c count times. */ void SetNoteInterval(int count); /** Sets the SDES name item for the local participant to the value \c s with length \c len. */ int SetLocalName(const void *s,size_t len); /** Sets the SDES e-mail item for the local participant to the value \c s with length \c len. */ int SetLocalEMail(const void *s,size_t len); /** Sets the SDES location item for the local participant to the value \c s with length \c len. */ int SetLocalLocation(const void *s,size_t len); /** Sets the SDES phone item for the local participant to the value \c s with length \c len. */ int SetLocalPhone(const void *s,size_t len); /** Sets the SDES tool item for the local participant to the value \c s with length \c len. */ int SetLocalTool(const void *s,size_t len); /** Sets the SDES note item for the local participant to the value \c s with length \c len. */ int SetLocalNote(const void *s,size_t len);#ifdef RTPDEBUG void DumpSources(); void DumpTransmitter();#endif // RTPDEBUGprotected: /** Allocate a user defined transmitter. * In case you specified in the Create function that you want to use a * user defined transmitter, you should override this function. The RTPTransmitter * instance returned by this function will then be used to send and receive RTP and * RTCP packets. Note that when the session is destroyed, this RTPTransmitter * instance will be destroyed as well. */ virtual RTPTransmitter *NewUserDefinedTransmitter() { return 0; } /** Is called when an incoming RTCP packet is about to be processed. */ virtual void OnRTPPacket(RTPPacket *pack,const RTPTime &receivetime, const RTPAddress *senderaddress) { } /** Is called when an incoming RTCP packet is about to be processed. */ virtual void OnRTCPCompoundPacket(RTCPCompoundPacket *pack,const RTPTime &receivetime, const RTPAddress *senderaddress) { } /** Is called when an SSRC collision was detected. * Is called when an SSRC collision was detected. The instance \c srcdat is the one present in * the table, the address \c senderaddress is the one that collided with one of the addresses * and \c isrtp indicates against which address of \c srcdat the check failed. */ virtual void OnSSRCCollision(RTPSourceData *srcdat,const RTPAddress *senderaddress,bool isrtp) { } /** Is called when another CNAME was received than the one already present for source \c srcdat. */ virtual void OnCNAMECollision(RTPSourceData *srcdat,const RTPAddress *senderaddress, const uint8_t *cname,size_t cnamelength) { } /** Is called when a new entry \c srcdat is added to the source table. */ virtual void OnNewSource(RTPSourceData *srcdat) { } /** Is called when the entry \c srcdat is about to be deleted from the source table. */ virtual void OnRemoveSource(RTPSourceData *srcdat) { } /** Is called when participant \c srcdat is timed out. */ virtual void OnTimeout(RTPSourceData *srcdat) { } /** Is called when participant \c srcdat is timed after having sent a BYE packet. */ virtual void OnBYETimeout(RTPSourceData *srcdat) { } /** Is called when an RTCP APP packet \c apppacket has been received at time \c receivetime * from address \c senderaddress. */ virtual void OnAPPPacket(RTCPAPPPacket *apppacket,const RTPTime &receivetime, const RTPAddress *senderaddress) { } /** Is called when an unknown RTCP packet type was detected. */ virtual void OnUnknownPacketType(RTCPPacket *rtcppack,const RTPTime &receivetime, const RTPAddress *senderaddress) { } /** Is called when an unknown packet format for a known packet type was detected. */ virtual void OnUnknownPacketFormat(RTCPPacket *rtcppack,const RTPTime &receivetime, const RTPAddress *senderaddress) { } /** Is called when the SDES NOTE item for source \c srcdat has been timed out. */ virtual void OnNoteTimeout(RTPSourceData *srcdat) { } /** Is called when a BYE packet has been processed for source \c srcdat. */ virtual void OnBYEPacket(RTPSourceData *srcdat) { } /** Is called when an RTCP compound packet has just been sent (useful to inspect outgoing RTCP data). */ virtual void OnSendRTCPCompoundPacket(RTCPCompoundPacket *pack) { }#ifdef RTP_SUPPORT_THREAD /** Is called when error \c errcode was detected in the poll thread. */ virtual void OnPollThreadError(int errcode) { } /** Is called each time the poll thread loops. * Is called each time the poll thread loops. This happens when incoming data was * detected or when it's time to send an RTCP compound packet. */ virtual void OnPollThreadStep() { }#endif // RTP_SUPPORT_THREADprivate: int InternalCreate(const RTPSessionParams &sessparams); int CreateCNAME(uint8_t *buffer,size_t *bufferlength,bool resolve); int ProcessPolledData(); int ProcessRTCPCompoundPacket(RTCPCompoundPacket &rtcpcomppack,RTPRawPacket *pack); RTPTransmitter *rtptrans; bool created; bool deletetransmitter; bool usingpollthread; bool acceptownpackets; bool useSR_BYEifpossible; size_t maxpacksize; double sessionbandwidth; double controlfragment; double sendermultiplier; double byemultiplier; double membermultiplier; double collisionmultiplier; double notemultiplier; bool sentpackets; RTPSessionSources sources; RTPPacketBuilder packetbuilder; RTCPScheduler rtcpsched; RTCPPacketBuilder rtcpbuilder; RTPCollisionList collisionlist; std::list<RTCPCompoundPacket *> byepackets; #ifdef RTP_SUPPORT_THREAD RTPPollThread *pollthread; JMutex sourcesmutex,buildermutex,schedmutex,packsentmutex; friend class RTPPollThread;#endif // RTP_SUPPORT_THREAD friend class RTPSessionSources; friend class RTCPSessionPacketBuilder;};#endif // RTPSESSION_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -