00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00037 #ifndef RTPINTERNALSOURCEDATA_H
00038
00039 #define RTPINTERNALSOURCEDATA_H
00040
00041 #include "rtpconfig.h"
00042 #include "rtpsourcedata.h"
00043 #include "rtpaddress.h"
00044 #include "rtptimeutilities.h"
00045 #include "rtpsources.h"
00046
00047 class RTPInternalSourceData : public RTPSourceData
00048 {
00049 public:
00050 RTPInternalSourceData(uint32_t ssrc, RTPSources::ProbationType probtype, RTPMemoryManager *mgr = 0);
00051 ~RTPInternalSourceData();
00052
00053 int ProcessRTPPacket(RTPPacket *rtppack,const RTPTime &receivetime,bool *stored);
00054 void ProcessSenderInfo(const RTPNTPTime &ntptime,uint32_t rtptime,uint32_t packetcount,
00055 uint32_t octetcount,const RTPTime &receivetime) { SRprevinf = SRinf; SRinf.Set(ntptime,rtptime,packetcount,octetcount,receivetime); stats.SetLastMessageTime(receivetime); }
00056 void ProcessReportBlock(uint8_t fractionlost,int32_t lostpackets,uint32_t exthighseqnr,
00057 uint32_t jitter,uint32_t lsr,uint32_t dlsr,
00058 const RTPTime &receivetime) { RRprevinf = RRinf; RRinf.Set(fractionlost,lostpackets,exthighseqnr,jitter,lsr,dlsr,receivetime); stats.SetLastMessageTime(receivetime); }
00059 void UpdateMessageTime(const RTPTime &receivetime) { stats.SetLastMessageTime(receivetime); }
00060 int ProcessSDESItem(uint8_t sdesid,const uint8_t *data,size_t itemlen,const RTPTime &receivetime,bool *cnamecollis);
00061 #ifdef RTP_SUPPORT_SDESPRIV
00062 int ProcessPrivateSDESItem(const uint8_t *prefix,size_t prefixlen,const uint8_t *value,size_t valuelen,const RTPTime &receivetime);
00063 #endif // RTP_SUPPORT_SDESPRIV
00064 int ProcessBYEPacket(const uint8_t *reason,size_t reasonlen,const RTPTime &receivetime);
00065
00066 int SetRTPDataAddress(const RTPAddress *a);
00067 int SetRTCPDataAddress(const RTPAddress *a);
00068
00069 void ClearSenderFlag() { issender = false; }
00070 void SentRTPPacket() { if (!ownssrc) return; RTPTime t = RTPTime::CurrentTime(); issender = true; stats.SetLastRTPPacketTime(t); stats.SetLastMessageTime(t); }
00071 void SetOwnSSRC() { ownssrc = true; validated = true; }
00072 void SetCSRC() { validated = true; iscsrc = true; }
00073 void ClearNote() { SDESinf.SetNote(0,0); }
00074
00075 #ifdef RTP_SUPPORT_PROBATION
00076 private:
00077 RTPSources::ProbationType probationtype;
00078 #endif // RTP_SUPPORT_PROBATION
00079 };
00080
00081 inline int RTPInternalSourceData::SetRTPDataAddress(const RTPAddress *a)
00082 {
00083 if (a == 0)
00084 {
00085 if (rtpaddr)
00086 {
00087 RTPDelete(rtpaddr,GetMemoryManager());
00088 rtpaddr = 0;
00089 }
00090 }
00091 else
00092 {
00093 RTPAddress *newaddr = a->CreateCopy(GetMemoryManager());
00094 if (newaddr == 0)
00095 return ERR_RTP_OUTOFMEM;
00096
00097 if (rtpaddr && a != rtpaddr)
00098 RTPDelete(rtpaddr,GetMemoryManager());
00099 rtpaddr = newaddr;
00100 }
00101 isrtpaddrset = true;
00102 return 0;
00103 }
00104
00105 inline int RTPInternalSourceData::SetRTCPDataAddress(const RTPAddress *a)
00106 {
00107 if (a == 0)
00108 {
00109 if (rtcpaddr)
00110 {
00111 RTPDelete(rtcpaddr,GetMemoryManager());
00112 rtcpaddr = 0;
00113 }
00114 }
00115 else
00116 {
00117 RTPAddress *newaddr = a->CreateCopy(GetMemoryManager());
00118 if (newaddr == 0)
00119 return ERR_RTP_OUTOFMEM;
00120
00121 if (rtcpaddr && a != rtcpaddr)
00122 RTPDelete(rtcpaddr,GetMemoryManager());
00123 rtcpaddr = newaddr;
00124 }
00125 isrtcpaddrset = true;
00126 return 0;
00127 }
00128
00129 #endif // RTPINTERNALSOURCEDATA_H
00130