mirror of https://github.com/f4exb/sdrangel.git
qrtplib: replaced size_t by std::size_t
This commit is contained in:
parent
9bcabb708d
commit
f678c049f9
|
@ -35,13 +35,13 @@
|
||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
|
||||||
RTCPAPPPacket::RTCPAPPPacket(uint8_t *data, size_t datalength) :
|
RTCPAPPPacket::RTCPAPPPacket(uint8_t *data, std::size_t datalength) :
|
||||||
RTCPPacket(APP, data, datalength)
|
RTCPPacket(APP, data, datalength)
|
||||||
{
|
{
|
||||||
knownformat = false;
|
knownformat = false;
|
||||||
|
|
||||||
RTCPCommonHeader *hdr;
|
RTCPCommonHeader *hdr;
|
||||||
size_t len = datalength;
|
std::size_t len = datalength;
|
||||||
|
|
||||||
hdr = (RTCPCommonHeader *) data;
|
hdr = (RTCPCommonHeader *) data;
|
||||||
if (hdr->padding)
|
if (hdr->padding)
|
||||||
|
@ -49,9 +49,9 @@ RTCPAPPPacket::RTCPAPPPacket(uint8_t *data, size_t datalength) :
|
||||||
uint8_t padcount = data[datalength - 1];
|
uint8_t padcount = data[datalength - 1];
|
||||||
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
||||||
return;
|
return;
|
||||||
if (((size_t) padcount) >= len)
|
if (((std::size_t) padcount) >= len)
|
||||||
return;
|
return;
|
||||||
len -= (size_t) padcount;
|
len -= (std::size_t) padcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len < (sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2))
|
if (len < (sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2))
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
||||||
* points to is valid as long as the class instance exists.
|
* points to is valid as long as the class instance exists.
|
||||||
*/
|
*/
|
||||||
RTCPAPPPacket(uint8_t *data, size_t datalen);
|
RTCPAPPPacket(uint8_t *data, std::size_t datalen);
|
||||||
~RTCPAPPPacket()
|
~RTCPAPPPacket()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,10 @@ public:
|
||||||
uint8_t *GetAPPData();
|
uint8_t *GetAPPData();
|
||||||
|
|
||||||
/** Returns the length of the actual data. */
|
/** Returns the length of the actual data. */
|
||||||
size_t GetAPPDataLength() const;
|
std::size_t GetAPPDataLength() const;
|
||||||
private:
|
private:
|
||||||
RTPEndian m_endian;
|
RTPEndian m_endian;
|
||||||
size_t appdatalen;
|
std::size_t appdatalen;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline uint8_t RTCPAPPPacket::GetSubType() const
|
inline uint8_t RTCPAPPPacket::GetSubType() const
|
||||||
|
@ -117,7 +117,7 @@ inline uint8_t *RTCPAPPPacket::GetAPPData()
|
||||||
return (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2);
|
return (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t RTCPAPPPacket::GetAPPDataLength() const
|
inline std::size_t RTCPAPPPacket::GetAPPDataLength() const
|
||||||
{
|
{
|
||||||
if (!knownformat)
|
if (!knownformat)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -35,14 +35,14 @@
|
||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
|
||||||
RTCPBYEPacket::RTCPBYEPacket(uint8_t *data, size_t datalength) :
|
RTCPBYEPacket::RTCPBYEPacket(uint8_t *data, std::size_t datalength) :
|
||||||
RTCPPacket(BYE, data, datalength)
|
RTCPPacket(BYE, data, datalength)
|
||||||
{
|
{
|
||||||
knownformat = false;
|
knownformat = false;
|
||||||
reasonoffset = 0;
|
reasonoffset = 0;
|
||||||
|
|
||||||
RTCPCommonHeader *hdr;
|
RTCPCommonHeader *hdr;
|
||||||
size_t len = datalength;
|
std::size_t len = datalength;
|
||||||
|
|
||||||
hdr = (RTCPCommonHeader *) data;
|
hdr = (RTCPCommonHeader *) data;
|
||||||
if (hdr->padding)
|
if (hdr->padding)
|
||||||
|
@ -50,18 +50,18 @@ RTCPBYEPacket::RTCPBYEPacket(uint8_t *data, size_t datalength) :
|
||||||
uint8_t padcount = data[datalength - 1];
|
uint8_t padcount = data[datalength - 1];
|
||||||
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
||||||
return;
|
return;
|
||||||
if (((size_t) padcount) >= len)
|
if (((std::size_t) padcount) >= len)
|
||||||
return;
|
return;
|
||||||
len -= (size_t) padcount;
|
len -= (std::size_t) padcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ssrclen = ((size_t)(hdr->count)) * sizeof(uint32_t) + sizeof(RTCPCommonHeader);
|
std::size_t ssrclen = ((std::size_t)(hdr->count)) * sizeof(uint32_t) + sizeof(RTCPCommonHeader);
|
||||||
if (ssrclen > len)
|
if (ssrclen > len)
|
||||||
return;
|
return;
|
||||||
if (ssrclen < len) // there's probably a reason for leaving
|
if (ssrclen < len) // there's probably a reason for leaving
|
||||||
{
|
{
|
||||||
uint8_t *reasonlength = (data + ssrclen);
|
uint8_t *reasonlength = (data + ssrclen);
|
||||||
size_t reaslen = (size_t)(*reasonlength);
|
std::size_t reaslen = (std::size_t)(*reasonlength);
|
||||||
if (reaslen > (len - ssrclen - 1))
|
if (reaslen > (len - ssrclen - 1))
|
||||||
return;
|
return;
|
||||||
reasonoffset = ssrclen;
|
reasonoffset = ssrclen;
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
||||||
* points to is valid as long as the class instance exists.
|
* points to is valid as long as the class instance exists.
|
||||||
*/
|
*/
|
||||||
RTCPBYEPacket(uint8_t *data, size_t datalen);
|
RTCPBYEPacket(uint8_t *data, std::size_t datalen);
|
||||||
~RTCPBYEPacket()
|
~RTCPBYEPacket()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -74,14 +74,14 @@ public:
|
||||||
bool HasReasonForLeaving() const;
|
bool HasReasonForLeaving() const;
|
||||||
|
|
||||||
/** Returns the length of the string which describes why the source(s) left. */
|
/** Returns the length of the string which describes why the source(s) left. */
|
||||||
size_t GetReasonLength() const;
|
std::size_t GetReasonLength() const;
|
||||||
|
|
||||||
/** Returns the actual reason for leaving data. */
|
/** Returns the actual reason for leaving data. */
|
||||||
uint8_t *GetReasonData();
|
uint8_t *GetReasonData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RTPEndian m_endian;
|
RTPEndian m_endian;
|
||||||
size_t reasonoffset;
|
std::size_t reasonoffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int RTCPBYEPacket::GetSSRCCount() const
|
inline int RTCPBYEPacket::GetSSRCCount() const
|
||||||
|
@ -110,14 +110,14 @@ inline bool RTCPBYEPacket::HasReasonForLeaving() const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t RTCPBYEPacket::GetReasonLength() const
|
inline std::size_t RTCPBYEPacket::GetReasonLength() const
|
||||||
{
|
{
|
||||||
if (!knownformat)
|
if (!knownformat)
|
||||||
return 0;
|
return 0;
|
||||||
if (reasonoffset == 0)
|
if (reasonoffset == 0)
|
||||||
return 0;
|
return 0;
|
||||||
uint8_t *reasonlen = (data + reasonoffset);
|
uint8_t *reasonlen = (data + reasonoffset);
|
||||||
return (size_t)(*reasonlen);
|
return (std::size_t)(*reasonlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t *RTCPBYEPacket::GetReasonData()
|
inline uint8_t *RTCPBYEPacket::GetReasonData()
|
||||||
|
|
|
@ -58,7 +58,7 @@ RTCPCompoundPacket::RTCPCompoundPacket(RTPRawPacket &rawpack)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *data = rawpack.GetData();
|
uint8_t *data = rawpack.GetData();
|
||||||
size_t datalen = rawpack.GetDataLength();
|
std::size_t datalen = rawpack.GetDataLength();
|
||||||
|
|
||||||
error = ParseData(data, datalen);
|
error = ParseData(data, datalen);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
|
@ -73,7 +73,7 @@ RTCPCompoundPacket::RTCPCompoundPacket(RTPRawPacket &rawpack)
|
||||||
rtcppackit = rtcppacklist.begin();
|
rtcppackit = rtcppacklist.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
RTCPCompoundPacket::RTCPCompoundPacket(uint8_t *packet, size_t packetlen, bool deletedata)
|
RTCPCompoundPacket::RTCPCompoundPacket(uint8_t *packet, std::size_t packetlen, bool deletedata)
|
||||||
{
|
{
|
||||||
compoundpacket = 0;
|
compoundpacket = 0;
|
||||||
compoundpacketlength = 0;
|
compoundpacketlength = 0;
|
||||||
|
@ -97,7 +97,7 @@ RTCPCompoundPacket::RTCPCompoundPacket()
|
||||||
deletepacket = true;
|
deletepacket = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTCPCompoundPacket::ParseData(uint8_t *data, size_t datalen)
|
int RTCPCompoundPacket::ParseData(uint8_t *data, std::size_t datalen)
|
||||||
{
|
{
|
||||||
bool first;
|
bool first;
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ int RTCPCompoundPacket::ParseData(uint8_t *data, size_t datalen)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
RTCPCommonHeader *rtcphdr;
|
RTCPCommonHeader *rtcphdr;
|
||||||
size_t length;
|
std::size_t length;
|
||||||
|
|
||||||
rtcphdr = (RTCPCommonHeader *) data;
|
rtcphdr = (RTCPCommonHeader *) data;
|
||||||
if (rtcphdr->version != RTP_VERSION) // check version
|
if (rtcphdr->version != RTP_VERSION) // check version
|
||||||
|
@ -129,7 +129,7 @@ int RTCPCompoundPacket::ParseData(uint8_t *data, size_t datalen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
length = (size_t) m_endian.qToHost(rtcphdr->length);
|
length = (std::size_t) m_endian.qToHost(rtcphdr->length);
|
||||||
length++;
|
length++;
|
||||||
length *= sizeof(uint32_t);
|
length *= sizeof(uint32_t);
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ int RTCPCompoundPacket::ParseData(uint8_t *data, size_t datalen)
|
||||||
|
|
||||||
datalen -= length;
|
datalen -= length;
|
||||||
data += length;
|
data += length;
|
||||||
} while (datalen >= (size_t) sizeof(RTCPCommonHeader));
|
} while (datalen >= (std::size_t) sizeof(RTCPCommonHeader));
|
||||||
|
|
||||||
if (datalen != 0) // some remaining bytes
|
if (datalen != 0) // some remaining bytes
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
* flag specifies if the data in \c packet should be deleted when the compound packet is destroyed. If
|
* flag specifies if the data in \c packet should be deleted when the compound packet is destroyed. If
|
||||||
* specified, a memory manager will be installed.
|
* specified, a memory manager will be installed.
|
||||||
*/
|
*/
|
||||||
RTCPCompoundPacket(uint8_t *packet, size_t len, bool deletedata = true);
|
RTCPCompoundPacket(uint8_t *packet, std::size_t len, bool deletedata = true);
|
||||||
protected:
|
protected:
|
||||||
RTCPCompoundPacket(); // this is for the compoundpacket builder
|
RTCPCompoundPacket(); // this is for the compoundpacket builder
|
||||||
public:
|
public:
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the size of the entire RTCP compound packet. */
|
/** Returns the size of the entire RTCP compound packet. */
|
||||||
size_t GetCompoundPacketLength()
|
std::size_t GetCompoundPacketLength()
|
||||||
{
|
{
|
||||||
return compoundpacketlength;
|
return compoundpacketlength;
|
||||||
}
|
}
|
||||||
|
@ -109,13 +109,13 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ClearPacketList();
|
void ClearPacketList();
|
||||||
int ParseData(uint8_t *packet, size_t len);
|
int ParseData(uint8_t *packet, std::size_t len);
|
||||||
|
|
||||||
RTPEndian m_endian;
|
RTPEndian m_endian;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
uint8_t *compoundpacket;
|
uint8_t *compoundpacket;
|
||||||
size_t compoundpacketlength;
|
std::size_t compoundpacketlength;
|
||||||
bool deletepacket;
|
bool deletepacket;
|
||||||
|
|
||||||
std::list<RTCPPacket *> rtcppacklist;
|
std::list<RTCPPacket *> rtcppacklist;
|
||||||
|
|
|
@ -80,7 +80,7 @@ void RTCPCompoundPacketBuilder::ClearBuildBuffers()
|
||||||
appsize = 0;
|
appsize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTCPCompoundPacketBuilder::InitBuild(size_t maxpacketsize)
|
int RTCPCompoundPacketBuilder::InitBuild(std::size_t maxpacketsize)
|
||||||
{
|
{
|
||||||
if (arebuilding)
|
if (arebuilding)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYBUILDING;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYBUILDING;
|
||||||
|
@ -100,7 +100,7 @@ int RTCPCompoundPacketBuilder::InitBuild(size_t maxpacketsize)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTCPCompoundPacketBuilder::InitBuild(void *externalbuffer, size_t buffersize)
|
int RTCPCompoundPacketBuilder::InitBuild(void *externalbuffer, std::size_t buffersize)
|
||||||
{
|
{
|
||||||
if (arebuilding)
|
if (arebuilding)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYBUILDING;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYBUILDING;
|
||||||
|
@ -128,9 +128,9 @@ int RTCPCompoundPacketBuilder::StartSenderReport(uint32_t senderssrc, const RTPN
|
||||||
if (report.headerlength != 0)
|
if (report.headerlength != 0)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYGOTREPORT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYGOTREPORT;
|
||||||
|
|
||||||
size_t totalsize = byesize + appsize + sdes.NeededBytes();
|
std::size_t totalsize = byesize + appsize + sdes.NeededBytes();
|
||||||
size_t sizeleft = maximumpacketsize - totalsize;
|
std::size_t sizeleft = maximumpacketsize - totalsize;
|
||||||
size_t neededsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) + sizeof(RTCPSenderReport);
|
std::size_t neededsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) + sizeof(RTCPSenderReport);
|
||||||
|
|
||||||
if (neededsize > sizeleft)
|
if (neededsize > sizeleft)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
||||||
|
@ -160,9 +160,9 @@ int RTCPCompoundPacketBuilder::StartReceiverReport(uint32_t senderssrc)
|
||||||
if (report.headerlength != 0)
|
if (report.headerlength != 0)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYGOTREPORT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_ALREADYGOTREPORT;
|
||||||
|
|
||||||
size_t totalsize = byesize + appsize + sdes.NeededBytes();
|
std::size_t totalsize = byesize + appsize + sdes.NeededBytes();
|
||||||
size_t sizeleft = maximumpacketsize - totalsize;
|
std::size_t sizeleft = maximumpacketsize - totalsize;
|
||||||
size_t neededsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t);
|
std::size_t neededsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t);
|
||||||
|
|
||||||
if (neededsize > sizeleft)
|
if (neededsize > sizeleft)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
||||||
|
@ -185,8 +185,8 @@ int RTCPCompoundPacketBuilder::AddReportBlock(uint32_t ssrc, uint8_t fractionlos
|
||||||
if (report.headerlength == 0)
|
if (report.headerlength == 0)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_REPORTNOTSTARTED;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_REPORTNOTSTARTED;
|
||||||
|
|
||||||
size_t totalothersize = byesize + appsize + sdes.NeededBytes();
|
std::size_t totalothersize = byesize + appsize + sdes.NeededBytes();
|
||||||
size_t reportsizewithextrablock = report.NeededBytesWithExtraReportBlock();
|
std::size_t reportsizewithextrablock = report.NeededBytesWithExtraReportBlock();
|
||||||
|
|
||||||
if ((totalothersize + reportsizewithextrablock) > maximumpacketsize)
|
if ((totalothersize + reportsizewithextrablock) > maximumpacketsize)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
||||||
|
@ -218,8 +218,8 @@ int RTCPCompoundPacketBuilder::AddSDESSource(uint32_t ssrc)
|
||||||
if (!arebuilding)
|
if (!arebuilding)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING;
|
||||||
|
|
||||||
size_t totalotherbytes = byesize + appsize + report.NeededBytes();
|
std::size_t totalotherbytes = byesize + appsize + report.NeededBytes();
|
||||||
size_t sdessizewithextrasource = sdes.NeededBytesWithExtraSource();
|
std::size_t sdessizewithextrasource = sdes.NeededBytesWithExtraSource();
|
||||||
|
|
||||||
if ((totalotherbytes + sdessizewithextrasource) > maximumpacketsize)
|
if ((totalotherbytes + sdessizewithextrasource) > maximumpacketsize)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
||||||
|
@ -267,26 +267,26 @@ int RTCPCompoundPacketBuilder::AddSDESNormalItem(RTCPSDESPacket::ItemType t, con
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_INVALIDITEMTYPE;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_INVALIDITEMTYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t totalotherbytes = byesize + appsize + report.NeededBytes();
|
std::size_t totalotherbytes = byesize + appsize + report.NeededBytes();
|
||||||
size_t sdessizewithextraitem = sdes.NeededBytesWithExtraItem(itemlength);
|
std::size_t sdessizewithextraitem = sdes.NeededBytesWithExtraItem(itemlength);
|
||||||
|
|
||||||
if ((sdessizewithextraitem + totalotherbytes) > maximumpacketsize)
|
if ((sdessizewithextraitem + totalotherbytes) > maximumpacketsize)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
||||||
|
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
size_t len;
|
std::size_t len;
|
||||||
|
|
||||||
buf = new uint8_t[sizeof(RTCPSDESHeader) + (size_t) itemlength];
|
buf = new uint8_t[sizeof(RTCPSDESHeader) + (std::size_t) itemlength];
|
||||||
if (buf == 0)
|
if (buf == 0)
|
||||||
return ERR_RTP_OUTOFMEM;
|
return ERR_RTP_OUTOFMEM;
|
||||||
len = sizeof(RTCPSDESHeader) + (size_t) itemlength;
|
len = sizeof(RTCPSDESHeader) + (std::size_t) itemlength;
|
||||||
|
|
||||||
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (buf);
|
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (buf);
|
||||||
|
|
||||||
sdeshdr->sdesid = itemid;
|
sdeshdr->sdesid = itemid;
|
||||||
sdeshdr->length = itemlength;
|
sdeshdr->length = itemlength;
|
||||||
if (itemlength != 0)
|
if (itemlength != 0)
|
||||||
memcpy((buf + sizeof(RTCPSDESHeader)), itemdata, (size_t) itemlength);
|
memcpy((buf + sizeof(RTCPSDESHeader)), itemdata, (std::size_t) itemlength);
|
||||||
|
|
||||||
sdes.AddItem(buf, len);
|
sdes.AddItem(buf, len);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -300,23 +300,23 @@ int RTCPCompoundPacketBuilder::AddSDESPrivateItem(const void *prefixdata, uint8_
|
||||||
if (sdes.sdessources.empty())
|
if (sdes.sdessources.empty())
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE;
|
||||||
|
|
||||||
size_t itemlength = ((size_t) prefixlength) + 1 + ((size_t) valuelength);
|
std::size_t itemlength = ((std::size_t) prefixlength) + 1 + ((std::size_t) valuelength);
|
||||||
if (itemlength > 255)
|
if (itemlength > 255)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_TOTALITEMLENGTHTOOBIG;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_TOTALITEMLENGTHTOOBIG;
|
||||||
|
|
||||||
size_t totalotherbytes = byesize + appsize + report.NeededBytes();
|
std::size_t totalotherbytes = byesize + appsize + report.NeededBytes();
|
||||||
size_t sdessizewithextraitem = sdes.NeededBytesWithExtraItem(itemlength);
|
std::size_t sdessizewithextraitem = sdes.NeededBytesWithExtraItem(itemlength);
|
||||||
|
|
||||||
if ((sdessizewithextraitem + totalotherbytes) > maximumpacketsize)
|
if ((sdessizewithextraitem + totalotherbytes) > maximumpacketsize)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
||||||
|
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
size_t len;
|
std::size_t len;
|
||||||
|
|
||||||
buf = new uint8_t[sizeof(RTCPSDESHeader) + itemlength];
|
buf = new uint8_t[sizeof(RTCPSDESHeader) + itemlength];
|
||||||
if (buf == 0)
|
if (buf == 0)
|
||||||
return ERR_RTP_OUTOFMEM;
|
return ERR_RTP_OUTOFMEM;
|
||||||
len = sizeof(RTCPSDESHeader) + (size_t) itemlength;
|
len = sizeof(RTCPSDESHeader) + (std::size_t) itemlength;
|
||||||
|
|
||||||
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (buf);
|
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (buf);
|
||||||
|
|
||||||
|
@ -325,9 +325,9 @@ int RTCPCompoundPacketBuilder::AddSDESPrivateItem(const void *prefixdata, uint8_
|
||||||
|
|
||||||
buf[sizeof(RTCPSDESHeader)] = prefixlength;
|
buf[sizeof(RTCPSDESHeader)] = prefixlength;
|
||||||
if (prefixlength != 0)
|
if (prefixlength != 0)
|
||||||
memcpy((buf + sizeof(RTCPSDESHeader) + 1), prefixdata, (size_t) prefixlength);
|
memcpy((buf + sizeof(RTCPSDESHeader) + 1), prefixdata, (std::size_t) prefixlength);
|
||||||
if (valuelength != 0)
|
if (valuelength != 0)
|
||||||
memcpy((buf + sizeof(RTCPSDESHeader) + 1 + (size_t) prefixlength), valuedata, (size_t) valuelength);
|
memcpy((buf + sizeof(RTCPSDESHeader) + 1 + (std::size_t) prefixlength), valuedata, (std::size_t) valuelength);
|
||||||
|
|
||||||
sdes.AddItem(buf, len);
|
sdes.AddItem(buf, len);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -342,15 +342,15 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs, uint8_t numssrcs, c
|
||||||
if (numssrcs > 31)
|
if (numssrcs > 31)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_TOOMANYSSRCS;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_TOOMANYSSRCS;
|
||||||
|
|
||||||
size_t packsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) * ((size_t) numssrcs);
|
std::size_t packsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) * ((std::size_t) numssrcs);
|
||||||
size_t zerobytes = 0;
|
std::size_t zerobytes = 0;
|
||||||
|
|
||||||
if (reasonlength > 0)
|
if (reasonlength > 0)
|
||||||
{
|
{
|
||||||
packsize += 1; // 1 byte for the length;
|
packsize += 1; // 1 byte for the length;
|
||||||
packsize += (size_t) reasonlength;
|
packsize += (std::size_t) reasonlength;
|
||||||
|
|
||||||
size_t r = (packsize & 0x03);
|
std::size_t r = (packsize & 0x03);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
zerobytes = 4 - r;
|
zerobytes = 4 - r;
|
||||||
|
@ -358,13 +358,13 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs, uint8_t numssrcs, c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t totalotherbytes = appsize + byesize + sdes.NeededBytes() + report.NeededBytes();
|
std::size_t totalotherbytes = appsize + byesize + sdes.NeededBytes() + report.NeededBytes();
|
||||||
|
|
||||||
if ((totalotherbytes + packsize) > maximumpacketsize)
|
if ((totalotherbytes + packsize) > maximumpacketsize)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
||||||
|
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
size_t numwords;
|
std::size_t numwords;
|
||||||
|
|
||||||
buf = new uint8_t[packsize];
|
buf = new uint8_t[packsize];
|
||||||
if (buf == 0)
|
if (buf == 0)
|
||||||
|
@ -388,11 +388,11 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs, uint8_t numssrcs, c
|
||||||
|
|
||||||
if (reasonlength != 0)
|
if (reasonlength != 0)
|
||||||
{
|
{
|
||||||
size_t offset = sizeof(RTCPCommonHeader) + ((size_t) numssrcs) * sizeof(uint32_t);
|
std::size_t offset = sizeof(RTCPCommonHeader) + ((std::size_t) numssrcs) * sizeof(uint32_t);
|
||||||
|
|
||||||
buf[offset] = reasonlength;
|
buf[offset] = reasonlength;
|
||||||
memcpy((buf + offset + 1), reasondata, (size_t) reasonlength);
|
memcpy((buf + offset + 1), reasondata, (std::size_t) reasonlength);
|
||||||
for (size_t i = 0; i < zerobytes; i++)
|
for (std::size_t i = 0; i < zerobytes; i++)
|
||||||
buf[packsize - 1 - i] = 0;
|
buf[packsize - 1 - i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ int RTCPCompoundPacketBuilder::AddBYEPacket(uint32_t *ssrcs, uint8_t numssrcs, c
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTCPCompoundPacketBuilder::AddAPPPacket(uint8_t subtype, uint32_t ssrc, const uint8_t name[4], const void *appdata, size_t appdatalen)
|
int RTCPCompoundPacketBuilder::AddAPPPacket(uint8_t subtype, uint32_t ssrc, const uint8_t name[4], const void *appdata, std::size_t appdatalen)
|
||||||
{
|
{
|
||||||
if (!arebuilding)
|
if (!arebuilding)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTBUILDING;
|
||||||
|
@ -411,13 +411,13 @@ int RTCPCompoundPacketBuilder::AddAPPPacket(uint8_t subtype, uint32_t ssrc, cons
|
||||||
if ((appdatalen % 4) != 0)
|
if ((appdatalen % 4) != 0)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_ILLEGALAPPDATALENGTH;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_ILLEGALAPPDATALENGTH;
|
||||||
|
|
||||||
size_t appdatawords = appdatalen / 4;
|
std::size_t appdatawords = appdatalen / 4;
|
||||||
|
|
||||||
if ((appdatawords + 2) > 65535)
|
if ((appdatawords + 2) > 65535)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_APPDATALENTOOBIG;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_APPDATALENTOOBIG;
|
||||||
|
|
||||||
size_t packsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2 + appdatalen;
|
std::size_t packsize = sizeof(RTCPCommonHeader) + sizeof(uint32_t) * 2 + appdatalen;
|
||||||
size_t totalotherbytes = appsize + byesize + sdes.NeededBytes() + report.NeededBytes();
|
std::size_t totalotherbytes = appsize + byesize + sdes.NeededBytes() + report.NeededBytes();
|
||||||
|
|
||||||
if ((totalotherbytes + packsize) > maximumpacketsize)
|
if ((totalotherbytes + packsize) > maximumpacketsize)
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOTENOUGHBYTESLEFT;
|
||||||
|
@ -462,7 +462,7 @@ int RTCPCompoundPacketBuilder::EndBuild()
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOREPORTPRESENT;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOREPORTPRESENT;
|
||||||
|
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
size_t len;
|
std::size_t len;
|
||||||
|
|
||||||
len = appsize + byesize + report.NeededBytes() + sdes.NeededBytes();
|
len = appsize + byesize + report.NeededBytes() + sdes.NeededBytes();
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ int RTCPCompoundPacketBuilder::EndBuild()
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
RTCPCommonHeader *hdr = (RTCPCommonHeader *) curbuf;
|
RTCPCommonHeader *hdr = (RTCPCommonHeader *) curbuf;
|
||||||
size_t offset;
|
std::size_t offset;
|
||||||
|
|
||||||
hdr->version = 2;
|
hdr->version = 2;
|
||||||
hdr->padding = 0;
|
hdr->padding = 0;
|
||||||
|
@ -516,7 +516,7 @@ int RTCPCompoundPacketBuilder::EndBuild()
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t numwords = offset / sizeof(uint32_t);
|
std::size_t numwords = offset / sizeof(uint32_t);
|
||||||
|
|
||||||
hdr->length = qToBigEndian((uint16_t) (numwords - 1));
|
hdr->length = qToBigEndian((uint16_t) (numwords - 1));
|
||||||
hdr->count = count;
|
hdr->count = count;
|
||||||
|
@ -551,7 +551,7 @@ int RTCPCompoundPacketBuilder::EndBuild()
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
RTCPCommonHeader *hdr = (RTCPCommonHeader *) curbuf;
|
RTCPCommonHeader *hdr = (RTCPCommonHeader *) curbuf;
|
||||||
size_t offset = sizeof(RTCPCommonHeader);
|
std::size_t offset = sizeof(RTCPCommonHeader);
|
||||||
|
|
||||||
hdr->version = 2;
|
hdr->version = 2;
|
||||||
hdr->padding = 0;
|
hdr->padding = 0;
|
||||||
|
@ -579,11 +579,11 @@ int RTCPCompoundPacketBuilder::EndBuild()
|
||||||
curbuf[offset] = 0; // end of item list;
|
curbuf[offset] = 0; // end of item list;
|
||||||
offset++;
|
offset++;
|
||||||
|
|
||||||
size_t r = offset & 0x03;
|
std::size_t r = offset & 0x03;
|
||||||
if (r != 0) // align to 32 bit boundary
|
if (r != 0) // align to 32 bit boundary
|
||||||
{
|
{
|
||||||
size_t num = 4 - r;
|
std::size_t num = 4 - r;
|
||||||
size_t i;
|
std::size_t i;
|
||||||
|
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
curbuf[offset + i] = 0;
|
curbuf[offset + i] = 0;
|
||||||
|
@ -594,7 +594,7 @@ int RTCPCompoundPacketBuilder::EndBuild()
|
||||||
sourcecount++;
|
sourcecount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t numwords = offset / 4;
|
std::size_t numwords = offset / 4;
|
||||||
|
|
||||||
hdr->count = sourcecount;
|
hdr->count = sourcecount;
|
||||||
hdr->length = qToBigEndian((uint16_t) (numwords - 1));
|
hdr->length = qToBigEndian((uint16_t) (numwords - 1));
|
||||||
|
|
|
@ -66,13 +66,13 @@ public:
|
||||||
* Starts building an RTCP compound packet with maximum size \c maxpacketsize. New memory will be allocated
|
* Starts building an RTCP compound packet with maximum size \c maxpacketsize. New memory will be allocated
|
||||||
* to store the packet.
|
* to store the packet.
|
||||||
*/
|
*/
|
||||||
int InitBuild(size_t maxpacketsize);
|
int InitBuild(std::size_t maxpacketsize);
|
||||||
|
|
||||||
/** Starts building a RTCP compound packet.
|
/** Starts building a RTCP compound packet.
|
||||||
* Starts building a RTCP compound packet. Data will be stored in \c externalbuffer which
|
* Starts building a RTCP compound packet. Data will be stored in \c externalbuffer which
|
||||||
* can contain \c buffersize bytes.
|
* can contain \c buffersize bytes.
|
||||||
*/
|
*/
|
||||||
int InitBuild(void *externalbuffer, size_t buffersize);
|
int InitBuild(void *externalbuffer, std::size_t buffersize);
|
||||||
|
|
||||||
/** Adds a sender report to the compound packet.
|
/** Adds a sender report to the compound packet.
|
||||||
* Tells the packet builder that the packet should start with a sender report which will contain
|
* Tells the packet builder that the packet should start with a sender report which will contain
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
* Adds the APP packet specified by the arguments to the compound packet. Note that \c appdatalen has to be
|
* Adds the APP packet specified by the arguments to the compound packet. Note that \c appdatalen has to be
|
||||||
* a multiple of four.
|
* a multiple of four.
|
||||||
*/
|
*/
|
||||||
int AddAPPPacket(uint8_t subtype, uint32_t ssrc, const uint8_t name[4], const void *appdata, size_t appdatalen);
|
int AddAPPPacket(uint8_t subtype, uint32_t ssrc, const uint8_t name[4], const void *appdata, std::size_t appdatalen);
|
||||||
|
|
||||||
/** Finishes building the compound packet.
|
/** Finishes building the compound packet.
|
||||||
* Finishes building the compound packet. If successful, the RTCPCompoundPacket member functions
|
* Finishes building the compound packet. If successful, the RTCPCompoundPacket member functions
|
||||||
|
@ -134,13 +134,13 @@ private:
|
||||||
packetdata(0), packetlength(0)
|
packetdata(0), packetlength(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Buffer(uint8_t *data, size_t len) :
|
Buffer(uint8_t *data, std::size_t len) :
|
||||||
packetdata(data), packetlength(len)
|
packetdata(data), packetlength(len)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *packetdata;
|
uint8_t *packetdata;
|
||||||
size_t packetlength;
|
std::size_t packetlength;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Report
|
class Report
|
||||||
|
@ -170,9 +170,9 @@ private:
|
||||||
headerlength = 0;
|
headerlength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NeededBytes()
|
std::size_t NeededBytes()
|
||||||
{
|
{
|
||||||
size_t x, n, d, r;
|
std::size_t x, n, d, r;
|
||||||
n = reportblocks.size();
|
n = reportblocks.size();
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
|
@ -194,9 +194,9 @@ private:
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NeededBytesWithExtraReportBlock()
|
std::size_t NeededBytesWithExtraReportBlock()
|
||||||
{
|
{
|
||||||
size_t x, n, d, r;
|
std::size_t x, n, d, r;
|
||||||
n = reportblocks.size() + 1; // +1 for the extra block
|
n = reportblocks.size() + 1; // +1 for the extra block
|
||||||
x = n * sizeof(RTCPReceiverReport);
|
x = n * sizeof(RTCPReceiverReport);
|
||||||
d = n / 31; // max 31 reportblocks per report
|
d = n / 31; // max 31 reportblocks per report
|
||||||
|
@ -213,7 +213,7 @@ private:
|
||||||
|
|
||||||
uint8_t *headerdata;
|
uint8_t *headerdata;
|
||||||
uint32_t headerdata32[(sizeof(uint32_t) + sizeof(RTCPSenderReport)) / sizeof(uint32_t)]; // either for ssrc and sender info or just ssrc
|
uint32_t headerdata32[(sizeof(uint32_t) + sizeof(RTCPSenderReport)) / sizeof(uint32_t)]; // either for ssrc and sender info or just ssrc
|
||||||
size_t headerlength;
|
std::size_t headerlength;
|
||||||
std::list<Buffer> reportblocks;
|
std::list<Buffer> reportblocks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -235,9 +235,9 @@ private:
|
||||||
items.clear();
|
items.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NeededBytes()
|
std::size_t NeededBytes()
|
||||||
{
|
{
|
||||||
size_t x, r;
|
std::size_t x, r;
|
||||||
x = totalitemsize + 1; // +1 for the 0 byte which terminates the item list
|
x = totalitemsize + 1; // +1 for the 0 byte which terminates the item list
|
||||||
r = x % sizeof(uint32_t);
|
r = x % sizeof(uint32_t);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
|
@ -246,10 +246,10 @@ private:
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NeededBytesWithExtraItem(uint8_t itemdatalength)
|
std::size_t NeededBytesWithExtraItem(uint8_t itemdatalength)
|
||||||
{
|
{
|
||||||
size_t x, r;
|
std::size_t x, r;
|
||||||
x = totalitemsize + sizeof(RTCPSDESHeader) + (size_t) itemdatalength + 1;
|
x = totalitemsize + sizeof(RTCPSDESHeader) + (std::size_t) itemdatalength + 1;
|
||||||
r = x % sizeof(uint32_t);
|
r = x % sizeof(uint32_t);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
x += (sizeof(uint32_t) - r); // make sure it ends on a 32 bit boundary
|
x += (sizeof(uint32_t) - r); // make sure it ends on a 32 bit boundary
|
||||||
|
@ -257,7 +257,7 @@ private:
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddItem(uint8_t *buf, size_t len)
|
void AddItem(uint8_t *buf, std::size_t len)
|
||||||
{
|
{
|
||||||
Buffer b(buf, len);
|
Buffer b(buf, len);
|
||||||
totalitemsize += len;
|
totalitemsize += len;
|
||||||
|
@ -267,7 +267,7 @@ private:
|
||||||
uint32_t ssrc;
|
uint32_t ssrc;
|
||||||
std::list<Buffer> items;
|
std::list<Buffer> items;
|
||||||
private:
|
private:
|
||||||
size_t totalitemsize;
|
std::size_t totalitemsize;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SDES
|
class SDES
|
||||||
|
@ -302,7 +302,7 @@ private:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddItem(uint8_t *buf, size_t len)
|
int AddItem(uint8_t *buf, std::size_t len)
|
||||||
{
|
{
|
||||||
if (sdessources.empty())
|
if (sdessources.empty())
|
||||||
return ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE;
|
return ERR_RTP_RTCPCOMPPACKBUILDER_NOCURRENTSOURCE;
|
||||||
|
@ -310,11 +310,11 @@ private:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NeededBytes()
|
std::size_t NeededBytes()
|
||||||
{
|
{
|
||||||
std::list<SDESSource *>::const_iterator it;
|
std::list<SDESSource *>::const_iterator it;
|
||||||
size_t x = 0;
|
std::size_t x = 0;
|
||||||
size_t n, d, r;
|
std::size_t n, d, r;
|
||||||
|
|
||||||
if (sdessources.empty())
|
if (sdessources.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -330,11 +330,11 @@ private:
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NeededBytesWithExtraItem(uint8_t itemdatalength)
|
std::size_t NeededBytesWithExtraItem(uint8_t itemdatalength)
|
||||||
{
|
{
|
||||||
std::list<SDESSource *>::const_iterator it;
|
std::list<SDESSource *>::const_iterator it;
|
||||||
size_t x = 0;
|
std::size_t x = 0;
|
||||||
size_t n, d, r;
|
std::size_t n, d, r;
|
||||||
|
|
||||||
if (sdessources.empty())
|
if (sdessources.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -351,11 +351,11 @@ private:
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NeededBytesWithExtraSource()
|
std::size_t NeededBytesWithExtraSource()
|
||||||
{
|
{
|
||||||
std::list<SDESSource *>::const_iterator it;
|
std::list<SDESSource *>::const_iterator it;
|
||||||
size_t x = 0;
|
std::size_t x = 0;
|
||||||
size_t n, d, r;
|
std::size_t n, d, r;
|
||||||
|
|
||||||
if (sdessources.empty())
|
if (sdessources.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -381,7 +381,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
RTPEndian m_endian;
|
RTPEndian m_endian;
|
||||||
size_t maximumpacketsize;
|
std::size_t maximumpacketsize;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
bool external;
|
bool external;
|
||||||
bool arebuilding;
|
bool arebuilding;
|
||||||
|
@ -390,10 +390,10 @@ private:
|
||||||
SDES sdes;
|
SDES sdes;
|
||||||
|
|
||||||
std::list<Buffer> byepackets;
|
std::list<Buffer> byepackets;
|
||||||
size_t byesize;
|
std::size_t byesize;
|
||||||
|
|
||||||
std::list<Buffer> apppackets;
|
std::list<Buffer> apppackets;
|
||||||
size_t appsize;
|
std::size_t appsize;
|
||||||
|
|
||||||
void ClearBuildBuffers();
|
void ClearBuildBuffers();
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#include "rtpconfig.h"
|
#include "rtpconfig.h"
|
||||||
#include "rtptypes.h"
|
#include "rtptypes.h"
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
@ -61,7 +62,7 @@ public:
|
||||||
Unknown /**< The type of RTCP packet was not recognized. */
|
Unknown /**< The type of RTCP packet was not recognized. */
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
RTCPPacket(PacketType t, uint8_t *d, size_t dlen) :
|
RTCPPacket(PacketType t, uint8_t *d, std::size_t dlen) :
|
||||||
data(d), datalen(dlen), packettype(t)
|
data(d), datalen(dlen), packettype(t)
|
||||||
{
|
{
|
||||||
knownformat = false;
|
knownformat = false;
|
||||||
|
@ -90,14 +91,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the length of this RTCP packet. */
|
/** Returns the length of this RTCP packet. */
|
||||||
size_t GetPacketLength() const
|
std::size_t GetPacketLength() const
|
||||||
{
|
{
|
||||||
return datalen;
|
return datalen;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
size_t datalen;
|
std::size_t datalen;
|
||||||
bool knownformat;
|
bool knownformat;
|
||||||
private:
|
private:
|
||||||
const PacketType packettype;
|
const PacketType packettype;
|
||||||
|
|
|
@ -52,7 +52,7 @@ RTCPPacketBuilder::~RTCPPacketBuilder()
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTCPPacketBuilder::Init(size_t maxpacksize, double tsunit, const void *cname, size_t cnamelen)
|
int RTCPPacketBuilder::Init(std::size_t maxpacksize, double tsunit, const void *cname, std::size_t cnamelen)
|
||||||
{
|
{
|
||||||
if (init)
|
if (init)
|
||||||
return ERR_RTP_RTCPPACKETBUILDER_ALREADYINIT;
|
return ERR_RTP_RTCPPACKETBUILDER_ALREADYINIT;
|
||||||
|
@ -163,7 +163,7 @@ int RTCPPacketBuilder::BuildNextPacket(RTCPCompoundPacket **pack)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *owncname;
|
uint8_t *owncname;
|
||||||
size_t owncnamelen;
|
std::size_t owncnamelen;
|
||||||
|
|
||||||
owncname = ownsdesinfo.GetCNAME(&owncnamelen);
|
owncname = ownsdesinfo.GetCNAME(&owncnamelen);
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ int RTCPPacketBuilder::FillInSDES(RTCPCompoundPacketBuilder *rtcpcomppack, bool
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
size_t datalen;
|
std::size_t datalen;
|
||||||
|
|
||||||
*full = false;
|
*full = false;
|
||||||
*processedall = false;
|
*processedall = false;
|
||||||
|
@ -626,7 +626,7 @@ void RTCPPacketBuilder::ClearAllSDESFlags()
|
||||||
ownsdesinfo.ClearFlags();
|
ownsdesinfo.ClearFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, size_t reasonlength, bool useSRifpossible)
|
int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, std::size_t reasonlength, bool useSRifpossible)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
||||||
|
@ -697,7 +697,7 @@ int RTCPPacketBuilder::BuildBYEPacket(RTCPCompoundPacket **pack, const void *rea
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *owncname;
|
uint8_t *owncname;
|
||||||
size_t owncnamelen;
|
std::size_t owncnamelen;
|
||||||
|
|
||||||
owncname = ownsdesinfo.GetCNAME(&owncnamelen);
|
owncname = ownsdesinfo.GetCNAME(&owncnamelen);
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
* The timestamp unit is defined as a time interval divided by the timestamp interval corresponding to
|
* The timestamp unit is defined as a time interval divided by the timestamp interval corresponding to
|
||||||
* that interval: for 8000 Hz audio this would be 1/8000.
|
* that interval: for 8000 Hz audio this would be 1/8000.
|
||||||
*/
|
*/
|
||||||
int Init(size_t maxpacksize, double timestampunit, const void *cname, size_t cnamelen);
|
int Init(std::size_t maxpacksize, double timestampunit, const void *cname, std::size_t cnamelen);
|
||||||
|
|
||||||
/** Cleans up the builder. */
|
/** Cleans up the builder. */
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
@ -97,7 +97,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the maximum size allowed size of an RTCP compound packet to \c maxpacksize. */
|
/** Sets the maximum size allowed size of an RTCP compound packet to \c maxpacksize. */
|
||||||
int SetMaximumPacketSize(size_t maxpacksize)
|
int SetMaximumPacketSize(std::size_t maxpacksize)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
||||||
|
@ -129,7 +129,7 @@ public:
|
||||||
* \c useSRifpossible is set to \c true, the RTCP compound packet will start with a sender report if
|
* \c useSRifpossible is set to \c true, the RTCP compound packet will start with a sender report if
|
||||||
* allowed. Otherwise, a receiver report is used.
|
* allowed. Otherwise, a receiver report is used.
|
||||||
*/
|
*/
|
||||||
int BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, size_t reasonlength, bool useSRifpossible = true);
|
int BuildBYEPacket(RTCPCompoundPacket **pack, const void *reason, std::size_t reasonlength, bool useSRifpossible = true);
|
||||||
|
|
||||||
/** Sets the RTCP interval for the SDES name item.
|
/** 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
|
* After all possible sources in the source table have been processed, the class will check if other
|
||||||
|
@ -210,7 +210,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES name item for the local participant to the value \c s with length \c len. */
|
/** 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)
|
int SetLocalName(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
||||||
|
@ -218,7 +218,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES e-mail item for the local participant to the value \c s with length \c 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)
|
int SetLocalEMail(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
||||||
|
@ -226,7 +226,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES location item for the local participant to the value \c s with length \c 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)
|
int SetLocalLocation(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
||||||
|
@ -234,7 +234,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES phone item for the local participant to the value \c s with length \c 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)
|
int SetLocalPhone(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
||||||
|
@ -242,7 +242,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES tool item for the local participant to the value \c s with length \c 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)
|
int SetLocalTool(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
||||||
|
@ -250,7 +250,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES note item for the local participant to the value \c s with length \c 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)
|
int SetLocalNote(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
return ERR_RTP_RTCPPACKETBUILDER_NOTINIT;
|
||||||
|
@ -258,7 +258,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the own CNAME item with length \c len */
|
/** Returns the own CNAME item with length \c len */
|
||||||
uint8_t *GetLocalCNAME(size_t *len) const
|
uint8_t *GetLocalCNAME(std::size_t *len) const
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -274,7 +274,7 @@ private:
|
||||||
RTPPacketBuilder &rtppacketbuilder;
|
RTPPacketBuilder &rtppacketbuilder;
|
||||||
|
|
||||||
bool init;
|
bool init;
|
||||||
size_t maxpacketsize;
|
std::size_t maxpacketsize;
|
||||||
double timestampunit;
|
double timestampunit;
|
||||||
bool firstpacket;
|
bool firstpacket;
|
||||||
RTPTime prevbuildtime, transmissiondelay;
|
RTPTime prevbuildtime, transmissiondelay;
|
||||||
|
|
|
@ -35,14 +35,14 @@
|
||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
|
||||||
RTCPRRPacket::RTCPRRPacket(uint8_t *data, size_t datalength) :
|
RTCPRRPacket::RTCPRRPacket(uint8_t *data, std::size_t datalength) :
|
||||||
RTCPPacket(RR, data, datalength)
|
RTCPPacket(RR, data, datalength)
|
||||||
{
|
{
|
||||||
knownformat = false;
|
knownformat = false;
|
||||||
|
|
||||||
RTCPCommonHeader *hdr;
|
RTCPCommonHeader *hdr;
|
||||||
size_t len = datalength;
|
std::size_t len = datalength;
|
||||||
size_t expectedlength;
|
std::size_t expectedlength;
|
||||||
|
|
||||||
hdr = (RTCPCommonHeader *) data;
|
hdr = (RTCPCommonHeader *) data;
|
||||||
if (hdr->padding)
|
if (hdr->padding)
|
||||||
|
@ -50,9 +50,9 @@ RTCPRRPacket::RTCPRRPacket(uint8_t *data, size_t datalength) :
|
||||||
uint8_t padcount = data[datalength - 1];
|
uint8_t padcount = data[datalength - 1];
|
||||||
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
||||||
return;
|
return;
|
||||||
if (((size_t) padcount) >= len)
|
if (((std::size_t) padcount) >= len)
|
||||||
return;
|
return;
|
||||||
len -= (size_t) padcount;
|
len -= (std::size_t) padcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedlength = sizeof(RTCPCommonHeader) + sizeof(uint32_t);
|
expectedlength = sizeof(RTCPCommonHeader) + sizeof(uint32_t);
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it points
|
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it points
|
||||||
* to is valid as long as the class instance exists.
|
* to is valid as long as the class instance exists.
|
||||||
*/
|
*/
|
||||||
RTCPRRPacket(uint8_t *data, size_t datalen);
|
RTCPRRPacket(uint8_t *data, std::size_t datalen);
|
||||||
~RTCPRRPacket()
|
~RTCPRRPacket()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,15 +120,15 @@ void RTCPScheduler::AnalyseIncoming(RTCPCompoundPacket &rtcpcomppack)
|
||||||
|
|
||||||
if (!isbye)
|
if (!isbye)
|
||||||
{
|
{
|
||||||
size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength();
|
std::size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength();
|
||||||
avgrtcppacksize = (size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgrtcppacksize));
|
avgrtcppacksize = (std::size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgrtcppacksize));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (byescheduled)
|
if (byescheduled)
|
||||||
{
|
{
|
||||||
size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength();
|
std::size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength();
|
||||||
avgbyepacketsize = (size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgbyepacketsize));
|
avgbyepacketsize = (std::size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgbyepacketsize));
|
||||||
byemembers++;
|
byemembers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,8 +148,8 @@ void RTCPScheduler::AnalyseOutgoing(RTCPCompoundPacket &rtcpcomppack)
|
||||||
|
|
||||||
if (!isbye)
|
if (!isbye)
|
||||||
{
|
{
|
||||||
size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength();
|
std::size_t packsize = headeroverhead + rtcpcomppack.GetCompoundPacketLength();
|
||||||
avgrtcppacksize = (size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgrtcppacksize));
|
avgrtcppacksize = (std::size_t)((1.0 / 16.0) * ((double) packsize) + (15.0 / 16.0) * ((double) avgrtcppacksize));
|
||||||
}
|
}
|
||||||
|
|
||||||
hassentrtcp = true;
|
hassentrtcp = true;
|
||||||
|
@ -354,7 +354,7 @@ void RTCPScheduler::PerformReverseReconsideration()
|
||||||
pmembers = members;
|
pmembers = members;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTCPScheduler::ScheduleBYEPacket(size_t packetsize)
|
void RTCPScheduler::ScheduleBYEPacket(std::size_t packetsize)
|
||||||
{
|
{
|
||||||
if (byescheduled)
|
if (byescheduled)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "rtpconfig.h"
|
#include "rtpconfig.h"
|
||||||
#include "rtptimeutilities.h"
|
#include "rtptimeutilities.h"
|
||||||
#include "rtprandom.h"
|
#include "rtprandom.h"
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
@ -148,13 +149,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the header overhead from underlying protocols (for example UDP and IP) to \c numbytes. */
|
/** Sets the header overhead from underlying protocols (for example UDP and IP) to \c numbytes. */
|
||||||
void SetHeaderOverhead(size_t numbytes)
|
void SetHeaderOverhead(std::size_t numbytes)
|
||||||
{
|
{
|
||||||
headeroverhead = numbytes;
|
headeroverhead = numbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the currently used header overhead. */
|
/** Returns the currently used header overhead. */
|
||||||
size_t GetHeaderOverhead() const
|
std::size_t GetHeaderOverhead() const
|
||||||
{
|
{
|
||||||
return headeroverhead;
|
return headeroverhead;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +172,7 @@ public:
|
||||||
/** Asks the scheduler to schedule an RTCP compound packet containing a BYE packetl; the compound packet
|
/** Asks the scheduler to schedule an RTCP compound packet containing a BYE packetl; the compound packet
|
||||||
* has size \c packetsize.
|
* has size \c packetsize.
|
||||||
*/
|
*/
|
||||||
void ScheduleBYEPacket(size_t packetsize);
|
void ScheduleBYEPacket(std::size_t packetsize);
|
||||||
|
|
||||||
/** Returns the delay after which an RTCP compound will possibly have to be sent.
|
/** Returns the delay after which an RTCP compound will possibly have to be sent.
|
||||||
* Returns the delay after which an RTCP compound will possibly have to be sent. The IsTime member function
|
* Returns the delay after which an RTCP compound will possibly have to be sent. The IsTime member function
|
||||||
|
@ -199,8 +200,8 @@ private:
|
||||||
|
|
||||||
RTPSources &sources;
|
RTPSources &sources;
|
||||||
RTCPSchedulerParams schedparams;
|
RTCPSchedulerParams schedparams;
|
||||||
size_t headeroverhead;
|
std::size_t headeroverhead;
|
||||||
size_t avgrtcppacksize;
|
std::size_t avgrtcppacksize;
|
||||||
bool hassentrtcp;
|
bool hassentrtcp;
|
||||||
bool firstcall;
|
bool firstcall;
|
||||||
RTPTime nextrtcptime;
|
RTPTime nextrtcptime;
|
||||||
|
@ -210,7 +211,7 @@ private:
|
||||||
// for BYE packet scheduling
|
// for BYE packet scheduling
|
||||||
bool byescheduled;
|
bool byescheduled;
|
||||||
int byemembers, pbyemembers;
|
int byemembers, pbyemembers;
|
||||||
size_t avgbyepacketsize;
|
std::size_t avgbyepacketsize;
|
||||||
bool sendbyenow;
|
bool sendbyenow;
|
||||||
|
|
||||||
RTPRandom &rtprand;
|
RTPRandom &rtprand;
|
||||||
|
|
|
@ -47,7 +47,7 @@ void RTCPSDESInfo::Clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix, size_t prefixlen, const uint8_t *value, size_t valuelen)
|
int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen)
|
||||||
{
|
{
|
||||||
std::list<SDESPrivateItem *>::const_iterator it;
|
std::list<SDESPrivateItem *>::const_iterator it;
|
||||||
bool found;
|
bool found;
|
||||||
|
@ -57,7 +57,7 @@ int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix, size_t prefixlen, const
|
||||||
while (!found && it != privitems.end())
|
while (!found && it != privitems.end())
|
||||||
{
|
{
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
size_t l;
|
std::size_t l;
|
||||||
|
|
||||||
p = (*it)->GetPrefix(&l);
|
p = (*it)->GetPrefix(&l);
|
||||||
if (l == prefixlen)
|
if (l == prefixlen)
|
||||||
|
@ -97,7 +97,7 @@ int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix, size_t prefixlen, const
|
||||||
return item->SetInfo(value, valuelen);
|
return item->SetInfo(value, valuelen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTCPSDESInfo::DeletePrivatePrefix(const uint8_t *prefix, size_t prefixlen)
|
int RTCPSDESInfo::DeletePrivatePrefix(const uint8_t *prefix, std::size_t prefixlen)
|
||||||
{
|
{
|
||||||
std::list<SDESPrivateItem *>::iterator it;
|
std::list<SDESPrivateItem *>::iterator it;
|
||||||
bool found;
|
bool found;
|
||||||
|
@ -107,7 +107,7 @@ int RTCPSDESInfo::DeletePrivatePrefix(const uint8_t *prefix, size_t prefixlen)
|
||||||
while (!found && it != privitems.end())
|
while (!found && it != privitems.end())
|
||||||
{
|
{
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
size_t l;
|
std::size_t l;
|
||||||
|
|
||||||
p = (*it)->GetPrefix(&l);
|
p = (*it)->GetPrefix(&l);
|
||||||
if (l == prefixlen)
|
if (l == prefixlen)
|
||||||
|
@ -135,7 +135,7 @@ void RTCPSDESInfo::GotoFirstPrivateValue()
|
||||||
curitem = privitems.begin();
|
curitem = privitems.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTCPSDESInfo::GetNextPrivateValue(uint8_t **prefix, size_t *prefixlen, uint8_t **value, size_t *valuelen)
|
bool RTCPSDESInfo::GetNextPrivateValue(uint8_t **prefix, std::size_t *prefixlen, uint8_t **value, std::size_t *valuelen)
|
||||||
{
|
{
|
||||||
if (curitem == privitems.end())
|
if (curitem == privitems.end())
|
||||||
return false;
|
return false;
|
||||||
|
@ -145,7 +145,7 @@ bool RTCPSDESInfo::GetNextPrivateValue(uint8_t **prefix, size_t *prefixlen, uint
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTCPSDESInfo::GetPrivateValue(const uint8_t *prefix, size_t prefixlen, uint8_t **value, size_t *valuelen) const
|
bool RTCPSDESInfo::GetPrivateValue(const uint8_t *prefix, std::size_t prefixlen, uint8_t **value, std::size_t *valuelen) const
|
||||||
{
|
{
|
||||||
std::list<SDESPrivateItem *>::const_iterator it;
|
std::list<SDESPrivateItem *>::const_iterator it;
|
||||||
bool found;
|
bool found;
|
||||||
|
@ -155,7 +155,7 @@ bool RTCPSDESInfo::GetPrivateValue(const uint8_t *prefix, size_t prefixlen, uint
|
||||||
while (!found && it != privitems.end())
|
while (!found && it != privitems.end())
|
||||||
{
|
{
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
size_t l;
|
std::size_t l;
|
||||||
|
|
||||||
p = (*it)->GetPrefix(&l);
|
p = (*it)->GetPrefix(&l);
|
||||||
if (l == prefixlen)
|
if (l == prefixlen)
|
||||||
|
|
|
@ -65,43 +65,43 @@ public:
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
/** Sets the SDES CNAME item to \c s with length \c l. */
|
/** Sets the SDES CNAME item to \c s with length \c l. */
|
||||||
int SetCNAME(const uint8_t *s, size_t l)
|
int SetCNAME(const uint8_t *s, std::size_t l)
|
||||||
{
|
{
|
||||||
return SetNonPrivateItem(RTCP_SDES_ID_CNAME - 1, s, l);
|
return SetNonPrivateItem(RTCP_SDES_ID_CNAME - 1, s, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES name item to \c s with length \c l. */
|
/** Sets the SDES name item to \c s with length \c l. */
|
||||||
int SetName(const uint8_t *s, size_t l)
|
int SetName(const uint8_t *s, std::size_t l)
|
||||||
{
|
{
|
||||||
return SetNonPrivateItem(RTCP_SDES_ID_NAME - 1, s, l);
|
return SetNonPrivateItem(RTCP_SDES_ID_NAME - 1, s, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES e-mail item to \c s with length \c l. */
|
/** Sets the SDES e-mail item to \c s with length \c l. */
|
||||||
int SetEMail(const uint8_t *s, size_t l)
|
int SetEMail(const uint8_t *s, std::size_t l)
|
||||||
{
|
{
|
||||||
return SetNonPrivateItem(RTCP_SDES_ID_EMAIL - 1, s, l);
|
return SetNonPrivateItem(RTCP_SDES_ID_EMAIL - 1, s, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES phone item to \c s with length \c l. */
|
/** Sets the SDES phone item to \c s with length \c l. */
|
||||||
int SetPhone(const uint8_t *s, size_t l)
|
int SetPhone(const uint8_t *s, std::size_t l)
|
||||||
{
|
{
|
||||||
return SetNonPrivateItem(RTCP_SDES_ID_PHONE - 1, s, l);
|
return SetNonPrivateItem(RTCP_SDES_ID_PHONE - 1, s, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES location item to \c s with length \c l. */
|
/** Sets the SDES location item to \c s with length \c l. */
|
||||||
int SetLocation(const uint8_t *s, size_t l)
|
int SetLocation(const uint8_t *s, std::size_t l)
|
||||||
{
|
{
|
||||||
return SetNonPrivateItem(RTCP_SDES_ID_LOCATION - 1, s, l);
|
return SetNonPrivateItem(RTCP_SDES_ID_LOCATION - 1, s, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES tool item to \c s with length \c l. */
|
/** Sets the SDES tool item to \c s with length \c l. */
|
||||||
int SetTool(const uint8_t *s, size_t l)
|
int SetTool(const uint8_t *s, std::size_t l)
|
||||||
{
|
{
|
||||||
return SetNonPrivateItem(RTCP_SDES_ID_TOOL - 1, s, l);
|
return SetNonPrivateItem(RTCP_SDES_ID_TOOL - 1, s, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the SDES note item to \c s with length \c l. */
|
/** Sets the SDES note item to \c s with length \c l. */
|
||||||
int SetNote(const uint8_t *s, size_t l)
|
int SetNote(const uint8_t *s, std::size_t l)
|
||||||
{
|
{
|
||||||
return SetNonPrivateItem(RTCP_SDES_ID_NOTE - 1, s, l);
|
return SetNonPrivateItem(RTCP_SDES_ID_NOTE - 1, s, l);
|
||||||
}
|
}
|
||||||
|
@ -111,50 +111,50 @@ public:
|
||||||
* the value string specified by \c value with length \c valuelen (if the maximum allowed
|
* the value string specified by \c value with length \c valuelen (if the maximum allowed
|
||||||
* number of prefixes was reached, the error code \c ERR_RTP_SDES_MAXPRIVITEMS is returned.
|
* number of prefixes was reached, the error code \c ERR_RTP_SDES_MAXPRIVITEMS is returned.
|
||||||
*/
|
*/
|
||||||
int SetPrivateValue(const uint8_t *prefix, size_t prefixlen, const uint8_t *value, size_t valuelen);
|
int SetPrivateValue(const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen);
|
||||||
|
|
||||||
/** Deletes the entry for the prefix specified by \c s with length \c len. */
|
/** Deletes the entry for the prefix specified by \c s with length \c len. */
|
||||||
int DeletePrivatePrefix(const uint8_t *s, size_t len);
|
int DeletePrivatePrefix(const uint8_t *s, std::size_t len);
|
||||||
#endif // RTP_SUPPORT_SDESPRIV
|
#endif // RTP_SUPPORT_SDESPRIV
|
||||||
|
|
||||||
/** Returns the SDES CNAME item and stores its length in \c len. */
|
/** Returns the SDES CNAME item and stores its length in \c len. */
|
||||||
uint8_t *GetCNAME(size_t *len) const
|
uint8_t *GetCNAME(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return GetNonPrivateItem(RTCP_SDES_ID_CNAME - 1, len);
|
return GetNonPrivateItem(RTCP_SDES_ID_CNAME - 1, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the SDES name item and stores its length in \c len. */
|
/** Returns the SDES name item and stores its length in \c len. */
|
||||||
uint8_t *GetName(size_t *len) const
|
uint8_t *GetName(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return GetNonPrivateItem(RTCP_SDES_ID_NAME - 1, len);
|
return GetNonPrivateItem(RTCP_SDES_ID_NAME - 1, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the SDES e-mail item and stores its length in \c len. */
|
/** Returns the SDES e-mail item and stores its length in \c len. */
|
||||||
uint8_t *GetEMail(size_t *len) const
|
uint8_t *GetEMail(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return GetNonPrivateItem(RTCP_SDES_ID_EMAIL - 1, len);
|
return GetNonPrivateItem(RTCP_SDES_ID_EMAIL - 1, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the SDES phone item and stores its length in \c len. */
|
/** Returns the SDES phone item and stores its length in \c len. */
|
||||||
uint8_t *GetPhone(size_t *len) const
|
uint8_t *GetPhone(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return GetNonPrivateItem(RTCP_SDES_ID_PHONE - 1, len);
|
return GetNonPrivateItem(RTCP_SDES_ID_PHONE - 1, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the SDES location item and stores its length in \c len. */
|
/** Returns the SDES location item and stores its length in \c len. */
|
||||||
uint8_t *GetLocation(size_t *len) const
|
uint8_t *GetLocation(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return GetNonPrivateItem(RTCP_SDES_ID_LOCATION - 1, len);
|
return GetNonPrivateItem(RTCP_SDES_ID_LOCATION - 1, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the SDES tool item and stores its length in \c len. */
|
/** Returns the SDES tool item and stores its length in \c len. */
|
||||||
uint8_t *GetTool(size_t *len) const
|
uint8_t *GetTool(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return GetNonPrivateItem(RTCP_SDES_ID_TOOL - 1, len);
|
return GetNonPrivateItem(RTCP_SDES_ID_TOOL - 1, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the SDES note item and stores its length in \c len. */
|
/** Returns the SDES note item and stores its length in \c len. */
|
||||||
uint8_t *GetNote(size_t *len) const
|
uint8_t *GetNote(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return GetNonPrivateItem(RTCP_SDES_ID_NOTE - 1, len);
|
return GetNonPrivateItem(RTCP_SDES_ID_NOTE - 1, len);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public:
|
||||||
* then stored in \c value and \c valuelen. Otherwise,
|
* then stored in \c value and \c valuelen. Otherwise,
|
||||||
* it returns \c false.
|
* it returns \c false.
|
||||||
*/
|
*/
|
||||||
bool GetNextPrivateValue(uint8_t **prefix, size_t *prefixlen, uint8_t **value, size_t *valuelen);
|
bool GetNextPrivateValue(uint8_t **prefix, std::size_t *prefixlen, uint8_t **value, std::size_t *valuelen);
|
||||||
|
|
||||||
/** Returns SDES priv item information.
|
/** Returns SDES priv item information.
|
||||||
* Looks for the entry which corresponds to the SDES private
|
* Looks for the entry which corresponds to the SDES private
|
||||||
|
@ -178,16 +178,16 @@ public:
|
||||||
* value and its length in \c value and \c valuelen
|
* value and its length in \c value and \c valuelen
|
||||||
* respectively.
|
* respectively.
|
||||||
*/
|
*/
|
||||||
bool GetPrivateValue(const uint8_t *prefix, size_t prefixlen, uint8_t **value, size_t *valuelen) const;
|
bool GetPrivateValue(const uint8_t *prefix, std::size_t prefixlen, uint8_t **value, std::size_t *valuelen) const;
|
||||||
#endif // RTP_SUPPORT_SDESPRIV
|
#endif // RTP_SUPPORT_SDESPRIV
|
||||||
private:
|
private:
|
||||||
int SetNonPrivateItem(int itemno, const uint8_t *s, size_t l)
|
int SetNonPrivateItem(int itemno, const uint8_t *s, std::size_t l)
|
||||||
{
|
{
|
||||||
if (l > RTCP_SDES_MAXITEMLENGTH)
|
if (l > RTCP_SDES_MAXITEMLENGTH)
|
||||||
return ERR_RTP_SDES_LENGTHTOOBIG;
|
return ERR_RTP_SDES_LENGTHTOOBIG;
|
||||||
return nonprivateitems[itemno].SetInfo(s, l);
|
return nonprivateitems[itemno].SetInfo(s, l);
|
||||||
}
|
}
|
||||||
uint8_t *GetNonPrivateItem(int itemno, size_t *len) const
|
uint8_t *GetNonPrivateItem(int itemno, std::size_t *len) const
|
||||||
{
|
{
|
||||||
return nonprivateitems[itemno].GetInfo(len);
|
return nonprivateitems[itemno].GetInfo(len);
|
||||||
}
|
}
|
||||||
|
@ -205,17 +205,17 @@ private:
|
||||||
if (str)
|
if (str)
|
||||||
delete[] str;
|
delete[] str;
|
||||||
}
|
}
|
||||||
uint8_t *GetInfo(size_t *len) const
|
uint8_t *GetInfo(std::size_t *len) const
|
||||||
{
|
{
|
||||||
*len = length;
|
*len = length;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
int SetInfo(const uint8_t *s, size_t len)
|
int SetInfo(const uint8_t *s, std::size_t len)
|
||||||
{
|
{
|
||||||
return SetString(&str, &length, s, len);
|
return SetString(&str, &length, s, len);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
int SetString(uint8_t **dest, size_t *destlen, const uint8_t *s, size_t len)
|
int SetString(uint8_t **dest, std::size_t *destlen, const uint8_t *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
{
|
{
|
||||||
|
@ -240,7 +240,7 @@ private:
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
uint8_t *str;
|
uint8_t *str;
|
||||||
size_t length;
|
std::size_t length;
|
||||||
};
|
};
|
||||||
|
|
||||||
SDESItem nonprivateitems[RTCP_SDES_NUMITEMS_NONPRIVATE];
|
SDESItem nonprivateitems[RTCP_SDES_NUMITEMS_NONPRIVATE];
|
||||||
|
@ -259,18 +259,18 @@ private:
|
||||||
if (prefix)
|
if (prefix)
|
||||||
delete[] prefix;
|
delete[] prefix;
|
||||||
}
|
}
|
||||||
uint8_t *GetPrefix(size_t *len) const
|
uint8_t *GetPrefix(std::size_t *len) const
|
||||||
{
|
{
|
||||||
*len = prefixlen;
|
*len = prefixlen;
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
int SetPrefix(const uint8_t *s, size_t len)
|
int SetPrefix(const uint8_t *s, std::size_t len)
|
||||||
{
|
{
|
||||||
return SetString(&prefix, &prefixlen, s, len);
|
return SetString(&prefix, &prefixlen, s, len);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
uint8_t *prefix;
|
uint8_t *prefix;
|
||||||
size_t prefixlen;
|
std::size_t prefixlen;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::list<SDESPrivateItem *> privitems;
|
std::list<SDESPrivateItem *> privitems;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
|
||||||
RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, size_t datalength) :
|
RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, std::size_t datalength) :
|
||||||
RTCPPacket(SDES, data, datalength)
|
RTCPPacket(SDES, data, datalength)
|
||||||
{
|
{
|
||||||
knownformat = false;
|
knownformat = false;
|
||||||
|
@ -44,16 +44,16 @@ RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, size_t datalength) :
|
||||||
curchunknum = 0;
|
curchunknum = 0;
|
||||||
|
|
||||||
RTCPCommonHeader *hdr = (RTCPCommonHeader *) data;
|
RTCPCommonHeader *hdr = (RTCPCommonHeader *) data;
|
||||||
size_t len = datalength;
|
std::size_t len = datalength;
|
||||||
|
|
||||||
if (hdr->padding)
|
if (hdr->padding)
|
||||||
{
|
{
|
||||||
uint8_t padcount = data[datalength - 1];
|
uint8_t padcount = data[datalength - 1];
|
||||||
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
||||||
return;
|
return;
|
||||||
if (((size_t) padcount) >= len)
|
if (((std::size_t) padcount) >= len)
|
||||||
return;
|
return;
|
||||||
len -= (size_t) padcount;
|
len -= (std::size_t) padcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->count == 0)
|
if (hdr->count == 0)
|
||||||
|
@ -93,10 +93,10 @@ RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, size_t datalength) :
|
||||||
len--;
|
len--;
|
||||||
chunkoffset++;
|
chunkoffset++;
|
||||||
|
|
||||||
size_t r = (chunkoffset & 0x03);
|
std::size_t r = (chunkoffset & 0x03);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
size_t addoffset = 4 - r;
|
std::size_t addoffset = 4 - r;
|
||||||
|
|
||||||
if (addoffset > len)
|
if (addoffset > len)
|
||||||
return;
|
return;
|
||||||
|
@ -113,7 +113,7 @@ RTCPSDESPacket::RTCPSDESPacket(uint8_t *data, size_t datalength) :
|
||||||
len -= sizeof(RTCPSDESHeader);
|
len -= sizeof(RTCPSDESHeader);
|
||||||
chunkoffset += sizeof(RTCPSDESHeader);
|
chunkoffset += sizeof(RTCPSDESHeader);
|
||||||
|
|
||||||
size_t itemlen = (size_t)(sdeshdr->length);
|
std::size_t itemlen = (std::size_t)(sdeshdr->length);
|
||||||
if (itemlen > len)
|
if (itemlen > len)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
||||||
* points to is valid as long as the class instance exists.
|
* points to is valid as long as the class instance exists.
|
||||||
*/
|
*/
|
||||||
RTCPSDESPacket(uint8_t *data, size_t datalen);
|
RTCPSDESPacket(uint8_t *data, std::size_t datalen);
|
||||||
~RTCPSDESPacket()
|
~RTCPSDESPacket()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ public:
|
||||||
ItemType GetItemType() const;
|
ItemType GetItemType() const;
|
||||||
|
|
||||||
/** Returns the item length of the current item in the current chunk. */
|
/** Returns the item length of the current item in the current chunk. */
|
||||||
size_t GetItemLength() const;
|
std::size_t GetItemLength() const;
|
||||||
|
|
||||||
/** Returns the item data of the current item in the current chunk. */
|
/** Returns the item data of the current item in the current chunk. */
|
||||||
uint8_t *GetItemData();
|
uint8_t *GetItemData();
|
||||||
|
@ -124,7 +124,7 @@ public:
|
||||||
/** If the current item is an SDES PRIV item, this function returns the length of the
|
/** If the current item is an SDES PRIV item, this function returns the length of the
|
||||||
* prefix string of the private item.
|
* prefix string of the private item.
|
||||||
*/
|
*/
|
||||||
size_t GetPRIVPrefixLength() const;
|
std::size_t GetPRIVPrefixLength() const;
|
||||||
|
|
||||||
/** If the current item is an SDES PRIV item, this function returns actual data of the
|
/** If the current item is an SDES PRIV item, this function returns actual data of the
|
||||||
* prefix string.
|
* prefix string.
|
||||||
|
@ -134,7 +134,7 @@ public:
|
||||||
/** If the current item is an SDES PRIV item, this function returns the length of the
|
/** If the current item is an SDES PRIV item, this function returns the length of the
|
||||||
* value string of the private item.
|
* value string of the private item.
|
||||||
*/
|
*/
|
||||||
size_t GetPRIVValueLength() const;
|
std::size_t GetPRIVValueLength() const;
|
||||||
|
|
||||||
/** If the current item is an SDES PRIV item, this function returns actual value data of the
|
/** If the current item is an SDES PRIV item, this function returns actual value data of the
|
||||||
* private item.
|
* private item.
|
||||||
|
@ -146,7 +146,7 @@ private:
|
||||||
RTPEndian m_endian;
|
RTPEndian m_endian;
|
||||||
uint8_t *currentchunk;
|
uint8_t *currentchunk;
|
||||||
int curchunknum;
|
int curchunknum;
|
||||||
size_t itemoffset;
|
std::size_t itemoffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int RTCPSDESPacket::GetChunkCount() const
|
inline int RTCPSDESPacket::GetChunkCount() const
|
||||||
|
@ -179,13 +179,13 @@ inline bool RTCPSDESPacket::GotoNextChunk()
|
||||||
if (curchunknum == GetChunkCount())
|
if (curchunknum == GetChunkCount())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
size_t offset = sizeof(uint32_t);
|
std::size_t offset = sizeof(uint32_t);
|
||||||
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (currentchunk + sizeof(uint32_t));
|
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (currentchunk + sizeof(uint32_t));
|
||||||
|
|
||||||
while (sdeshdr->sdesid != 0)
|
while (sdeshdr->sdesid != 0)
|
||||||
{
|
{
|
||||||
offset += sizeof(RTCPSDESHeader);
|
offset += sizeof(RTCPSDESHeader);
|
||||||
offset += (size_t)(sdeshdr->length);
|
offset += (std::size_t)(sdeshdr->length);
|
||||||
sdeshdr = (RTCPSDESHeader *) (currentchunk + offset);
|
sdeshdr = (RTCPSDESHeader *) (currentchunk + offset);
|
||||||
}
|
}
|
||||||
offset++; // for the zero byte
|
offset++; // for the zero byte
|
||||||
|
@ -231,9 +231,9 @@ inline bool RTCPSDESPacket::GotoNextItem()
|
||||||
if (sdeshdr->sdesid == 0)
|
if (sdeshdr->sdesid == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
size_t offset = itemoffset;
|
std::size_t offset = itemoffset;
|
||||||
offset += sizeof(RTCPSDESHeader);
|
offset += sizeof(RTCPSDESHeader);
|
||||||
offset += (size_t)(sdeshdr->length);
|
offset += (std::size_t)(sdeshdr->length);
|
||||||
sdeshdr = (RTCPSDESHeader *) (currentchunk + offset);
|
sdeshdr = (RTCPSDESHeader *) (currentchunk + offset);
|
||||||
if (sdeshdr->sdesid == 0)
|
if (sdeshdr->sdesid == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -274,7 +274,7 @@ inline RTCPSDESPacket::ItemType RTCPSDESPacket::GetItemType() const
|
||||||
return Unknown;
|
return Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t RTCPSDESPacket::GetItemLength() const
|
inline std::size_t RTCPSDESPacket::GetItemLength() const
|
||||||
{
|
{
|
||||||
if (!knownformat)
|
if (!knownformat)
|
||||||
return None;
|
return None;
|
||||||
|
@ -283,7 +283,7 @@ inline size_t RTCPSDESPacket::GetItemLength() const
|
||||||
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (currentchunk + itemoffset);
|
RTCPSDESHeader *sdeshdr = (RTCPSDESHeader *) (currentchunk + itemoffset);
|
||||||
if (sdeshdr->sdesid == 0)
|
if (sdeshdr->sdesid == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return (size_t)(sdeshdr->length);
|
return (std::size_t)(sdeshdr->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t *RTCPSDESPacket::GetItemData()
|
inline uint8_t *RTCPSDESPacket::GetItemData()
|
||||||
|
@ -299,7 +299,7 @@ inline uint8_t *RTCPSDESPacket::GetItemData()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
inline size_t RTCPSDESPacket::GetPRIVPrefixLength() const
|
inline std::size_t RTCPSDESPacket::GetPRIVPrefixLength() const
|
||||||
{
|
{
|
||||||
if (!knownformat)
|
if (!knownformat)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -311,8 +311,8 @@ inline size_t RTCPSDESPacket::GetPRIVPrefixLength() const
|
||||||
if (sdeshdr->length == 0)
|
if (sdeshdr->length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader);
|
uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader);
|
||||||
size_t prefixlength = (size_t)(*preflen);
|
std::size_t prefixlength = (std::size_t)(*preflen);
|
||||||
if (prefixlength > (size_t)((sdeshdr->length) - 1))
|
if (prefixlength > (std::size_t)((sdeshdr->length) - 1))
|
||||||
return 0;
|
return 0;
|
||||||
return prefixlength;
|
return prefixlength;
|
||||||
}
|
}
|
||||||
|
@ -329,15 +329,15 @@ inline uint8_t *RTCPSDESPacket::GetPRIVPrefixData()
|
||||||
if (sdeshdr->length == 0)
|
if (sdeshdr->length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader);
|
uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader);
|
||||||
size_t prefixlength = (size_t)(*preflen);
|
std::size_t prefixlength = (std::size_t)(*preflen);
|
||||||
if (prefixlength > (size_t)((sdeshdr->length) - 1))
|
if (prefixlength > (std::size_t)((sdeshdr->length) - 1))
|
||||||
return 0;
|
return 0;
|
||||||
if (prefixlength == 0)
|
if (prefixlength == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return (currentchunk + itemoffset + sizeof(RTCPSDESHeader) + 1);
|
return (currentchunk + itemoffset + sizeof(RTCPSDESHeader) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t RTCPSDESPacket::GetPRIVValueLength() const
|
inline std::size_t RTCPSDESPacket::GetPRIVValueLength() const
|
||||||
{
|
{
|
||||||
if (!knownformat)
|
if (!knownformat)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -349,10 +349,10 @@ inline size_t RTCPSDESPacket::GetPRIVValueLength() const
|
||||||
if (sdeshdr->length == 0)
|
if (sdeshdr->length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader);
|
uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader);
|
||||||
size_t prefixlength = (size_t)(*preflen);
|
std::size_t prefixlength = (std::size_t)(*preflen);
|
||||||
if (prefixlength > (size_t)((sdeshdr->length) - 1))
|
if (prefixlength > (std::size_t)((sdeshdr->length) - 1))
|
||||||
return 0;
|
return 0;
|
||||||
return ((size_t)(sdeshdr->length)) - prefixlength - 1;
|
return ((std::size_t)(sdeshdr->length)) - prefixlength - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t *RTCPSDESPacket::GetPRIVValueData()
|
inline uint8_t *RTCPSDESPacket::GetPRIVValueData()
|
||||||
|
@ -367,10 +367,10 @@ inline uint8_t *RTCPSDESPacket::GetPRIVValueData()
|
||||||
if (sdeshdr->length == 0)
|
if (sdeshdr->length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader);
|
uint8_t *preflen = currentchunk + itemoffset + sizeof(RTCPSDESHeader);
|
||||||
size_t prefixlength = (size_t)(*preflen);
|
std::size_t prefixlength = (std::size_t)(*preflen);
|
||||||
if (prefixlength > (size_t)((sdeshdr->length) - 1))
|
if (prefixlength > (std::size_t)((sdeshdr->length) - 1))
|
||||||
return 0;
|
return 0;
|
||||||
size_t valuelen = ((size_t)(sdeshdr->length)) - prefixlength - 1;
|
std::size_t valuelen = ((std::size_t)(sdeshdr->length)) - prefixlength - 1;
|
||||||
if (valuelen == 0)
|
if (valuelen == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return (currentchunk + itemoffset + sizeof(RTCPSDESHeader) + 1 + prefixlength);
|
return (currentchunk + itemoffset + sizeof(RTCPSDESHeader) + 1 + prefixlength);
|
||||||
|
|
|
@ -35,14 +35,14 @@
|
||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
|
||||||
RTCPSRPacket::RTCPSRPacket(uint8_t *data, size_t datalength) :
|
RTCPSRPacket::RTCPSRPacket(uint8_t *data, std::size_t datalength) :
|
||||||
RTCPPacket(SR, data, datalength)
|
RTCPPacket(SR, data, datalength)
|
||||||
{
|
{
|
||||||
knownformat = false;
|
knownformat = false;
|
||||||
|
|
||||||
RTCPCommonHeader *hdr;
|
RTCPCommonHeader *hdr;
|
||||||
size_t len = datalength;
|
std::size_t len = datalength;
|
||||||
size_t expectedlength;
|
std::size_t expectedlength;
|
||||||
|
|
||||||
hdr = (RTCPCommonHeader *) data;
|
hdr = (RTCPCommonHeader *) data;
|
||||||
if (hdr->padding)
|
if (hdr->padding)
|
||||||
|
@ -50,9 +50,9 @@ RTCPSRPacket::RTCPSRPacket(uint8_t *data, size_t datalength) :
|
||||||
uint8_t padcount = data[datalength - 1];
|
uint8_t padcount = data[datalength - 1];
|
||||||
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
|
||||||
return;
|
return;
|
||||||
if (((size_t) padcount) >= len)
|
if (((std::size_t) padcount) >= len)
|
||||||
return;
|
return;
|
||||||
len -= (size_t) padcount;
|
len -= (std::size_t) padcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedlength = sizeof(RTCPCommonHeader) + sizeof(uint32_t) + sizeof(RTCPSenderReport);
|
expectedlength = sizeof(RTCPCommonHeader) + sizeof(uint32_t) + sizeof(RTCPSenderReport);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
||||||
* points to is valid as long as the class instance exists.
|
* points to is valid as long as the class instance exists.
|
||||||
*/
|
*/
|
||||||
RTCPSRPacket(uint8_t *data, size_t datalength);
|
RTCPSRPacket(uint8_t *data, std::size_t datalength);
|
||||||
~RTCPSRPacket()
|
~RTCPSRPacket()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
* is referenced inside the class (no copy of the data is made) one must make sure that the memory it
|
||||||
* points to is valid as long as the class instance exists.
|
* points to is valid as long as the class instance exists.
|
||||||
*/
|
*/
|
||||||
RTCPUnknownPacket(uint8_t *data, size_t datalen) :
|
RTCPUnknownPacket(uint8_t *data, std::size_t datalen) :
|
||||||
RTCPPacket(Unknown, data, datalen)
|
RTCPPacket(Unknown, data, datalen)
|
||||||
{
|
{
|
||||||
// Since we don't expect a format, we'll trivially put knownformat = true
|
// Since we don't expect a format, we'll trivially put knownformat = true
|
||||||
|
|
|
@ -69,7 +69,7 @@ int RTPExternalTransmitter::Init(bool tsafe)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPExternalTransmitter::Create(size_t maximumpacketsize, const RTPTransmissionParams *transparams)
|
int RTPExternalTransmitter::Create(std::size_t maximumpacketsize, const RTPTransmissionParams *transparams)
|
||||||
{
|
{
|
||||||
const RTPExternalTransmissionParams *params;
|
const RTPExternalTransmissionParams *params;
|
||||||
int status;
|
int status;
|
||||||
|
@ -163,7 +163,7 @@ void RTPExternalTransmitter::DeleteTransmissionInfo(RTPTransmissionInfo *i)
|
||||||
delete i;
|
delete i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPExternalTransmitter::GetLocalHostName(uint8_t *buffer, size_t *bufferlength)
|
int RTPExternalTransmitter::GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_EXTERNALTRANS_NOTINIT;
|
return ERR_RTP_EXTERNALTRANS_NOTINIT;
|
||||||
|
@ -297,7 +297,7 @@ int RTPExternalTransmitter::AbortWait()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPExternalTransmitter::SendRTPData(const void *data, size_t len)
|
int RTPExternalTransmitter::SendRTPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_EXTERNALTRANS_NOTINIT;
|
return ERR_RTP_EXTERNALTRANS_NOTINIT;
|
||||||
|
@ -322,7 +322,7 @@ int RTPExternalTransmitter::SendRTPData(const void *data, size_t len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPExternalTransmitter::SendRTCPData(const void *data, size_t len)
|
int RTPExternalTransmitter::SendRTCPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_EXTERNALTRANS_NOTINIT;
|
return ERR_RTP_EXTERNALTRANS_NOTINIT;
|
||||||
|
@ -424,7 +424,7 @@ void RTPExternalTransmitter::ClearAcceptList()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPExternalTransmitter::SetMaximumPacketSize(size_t s)
|
int RTPExternalTransmitter::SetMaximumPacketSize(std::size_t s)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_EXTERNALTRANS_NOTINIT;
|
return ERR_RTP_EXTERNALTRANS_NOTINIT;
|
||||||
|
@ -490,7 +490,7 @@ void RTPExternalTransmitter::FlushPackets()
|
||||||
rawpacketlist.clear();
|
rawpacketlist.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPExternalTransmitter::InjectRTP(const void *data, size_t len, const RTPAddress &a)
|
void RTPExternalTransmitter::InjectRTP(const void *data, std::size_t len, const RTPAddress &a)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return;
|
return;
|
||||||
|
@ -534,7 +534,7 @@ void RTPExternalTransmitter::InjectRTP(const void *data, size_t len, const RTPAd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPExternalTransmitter::InjectRTCP(const void *data, size_t len, const RTPAddress &a)
|
void RTPExternalTransmitter::InjectRTCP(const void *data, std::size_t len, const RTPAddress &a)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return;
|
return;
|
||||||
|
@ -578,7 +578,7 @@ void RTPExternalTransmitter::InjectRTCP(const void *data, size_t len, const RTPA
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPExternalTransmitter::InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a)
|
void RTPExternalTransmitter::InjectRTPorRTCP(const void *data, std::size_t len, const RTPAddress &a)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -67,10 +67,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This member function will be called when RTP data needs to be transmitted. */
|
/** This member function will be called when RTP data needs to be transmitted. */
|
||||||
virtual bool SendRTP(const void *data, size_t len) = 0;
|
virtual bool SendRTP(const void *data, std::size_t len) = 0;
|
||||||
|
|
||||||
/** This member function will be called when an RTCP packet needs to be transmitted. */
|
/** This member function will be called when an RTCP packet needs to be transmitted. */
|
||||||
virtual bool SendRTCP(const void *data, size_t len) = 0;
|
virtual bool SendRTCP(const void *data, std::size_t len) = 0;
|
||||||
|
|
||||||
/** Used to identify if an RTPAddress instance originated from this sender (to be able to detect own packets). */
|
/** Used to identify if an RTPAddress instance originated from this sender (to be able to detect own packets). */
|
||||||
virtual bool ComesFromThisSender(const RTPAddress *a) = 0;
|
virtual bool ComesFromThisSender(const RTPAddress *a) = 0;
|
||||||
|
@ -95,13 +95,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This function can be called to insert an RTP packet into the transmission component. */
|
/** This function can be called to insert an RTP packet into the transmission component. */
|
||||||
void InjectRTP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTP(const void *data, std::size_t len, const RTPAddress &a);
|
||||||
|
|
||||||
/** This function can be called to insert an RTCP packet into the transmission component. */
|
/** This function can be called to insert an RTCP packet into the transmission component. */
|
||||||
void InjectRTCP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTCP(const void *data, std::size_t len, const RTPAddress &a);
|
||||||
|
|
||||||
/** Use this function to inject an RTP or RTCP packet and the transmitter will try to figure out which type of packet it is. */
|
/** Use this function to inject an RTP or RTCP packet and the transmitter will try to figure out which type of packet it is. */
|
||||||
void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTPorRTCP(const void *data, std::size_t len, const RTPAddress &a);
|
||||||
private:
|
private:
|
||||||
RTPExternalTransmitter *transmitter;
|
RTPExternalTransmitter *transmitter;
|
||||||
};
|
};
|
||||||
|
@ -167,14 +167,14 @@ public:
|
||||||
~RTPExternalTransmitter();
|
~RTPExternalTransmitter();
|
||||||
|
|
||||||
int Init(bool treadsafe);
|
int Init(bool treadsafe);
|
||||||
int Create(size_t maxpacksize, const RTPTransmissionParams *transparams);
|
int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams);
|
||||||
void Destroy();
|
void Destroy();
|
||||||
RTPTransmissionInfo *GetTransmissionInfo();
|
RTPTransmissionInfo *GetTransmissionInfo();
|
||||||
void DeleteTransmissionInfo(RTPTransmissionInfo *inf);
|
void DeleteTransmissionInfo(RTPTransmissionInfo *inf);
|
||||||
|
|
||||||
int GetLocalHostName(uint8_t *buffer, size_t *bufferlength);
|
int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength);
|
||||||
bool ComesFromThisTransmitter(const RTPAddress *addr);
|
bool ComesFromThisTransmitter(const RTPAddress *addr);
|
||||||
size_t GetHeaderOverhead()
|
std::size_t GetHeaderOverhead()
|
||||||
{
|
{
|
||||||
return headersize;
|
return headersize;
|
||||||
}
|
}
|
||||||
|
@ -183,8 +183,8 @@ public:
|
||||||
int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0);
|
int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0);
|
||||||
int AbortWait();
|
int AbortWait();
|
||||||
|
|
||||||
int SendRTPData(const void *data, size_t len);
|
int SendRTPData(const void *data, std::size_t len);
|
||||||
int SendRTCPData(const void *data, size_t len);
|
int SendRTCPData(const void *data, std::size_t len);
|
||||||
|
|
||||||
int AddDestination(const RTPAddress &addr);
|
int AddDestination(const RTPAddress &addr);
|
||||||
int DeleteDestination(const RTPAddress &addr);
|
int DeleteDestination(const RTPAddress &addr);
|
||||||
|
@ -202,14 +202,14 @@ public:
|
||||||
int AddToAcceptList(const RTPAddress &addr);
|
int AddToAcceptList(const RTPAddress &addr);
|
||||||
int DeleteFromAcceptList(const RTPAddress &addr);
|
int DeleteFromAcceptList(const RTPAddress &addr);
|
||||||
void ClearAcceptList();
|
void ClearAcceptList();
|
||||||
int SetMaximumPacketSize(size_t s);
|
int SetMaximumPacketSize(std::size_t s);
|
||||||
|
|
||||||
bool NewDataAvailable();
|
bool NewDataAvailable();
|
||||||
RTPRawPacket *GetNextPacket();
|
RTPRawPacket *GetNextPacket();
|
||||||
|
|
||||||
void InjectRTP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTP(const void *data, std::size_t len, const RTPAddress &a);
|
||||||
void InjectRTCP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTCP(const void *data, std::size_t len, const RTPAddress &a);
|
||||||
void InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a);
|
void InjectRTPorRTCP(const void *data, std::size_t len, const RTPAddress &a);
|
||||||
private:
|
private:
|
||||||
void FlushPackets();
|
void FlushPackets();
|
||||||
|
|
||||||
|
@ -222,26 +222,26 @@ private:
|
||||||
std::list<RTPRawPacket*> rawpacketlist;
|
std::list<RTPRawPacket*> rawpacketlist;
|
||||||
|
|
||||||
uint8_t *localhostname;
|
uint8_t *localhostname;
|
||||||
size_t localhostnamelength;
|
std::size_t localhostnamelength;
|
||||||
|
|
||||||
size_t maxpacksize;
|
std::size_t maxpacksize;
|
||||||
int headersize;
|
int headersize;
|
||||||
|
|
||||||
RTPAbortDescriptors m_abortDesc;
|
RTPAbortDescriptors m_abortDesc;
|
||||||
int m_abortCount;
|
int m_abortCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void RTPExternalPacketInjecter::InjectRTP(const void *data, size_t len, const RTPAddress &a)
|
inline void RTPExternalPacketInjecter::InjectRTP(const void *data, std::size_t len, const RTPAddress &a)
|
||||||
{
|
{
|
||||||
transmitter->InjectRTP(data, len, a);
|
transmitter->InjectRTP(data, len, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RTPExternalPacketInjecter::InjectRTCP(const void *data, size_t len, const RTPAddress &a)
|
inline void RTPExternalPacketInjecter::InjectRTCP(const void *data, std::size_t len, const RTPAddress &a)
|
||||||
{
|
{
|
||||||
transmitter->InjectRTCP(data, len, a);
|
transmitter->InjectRTCP(data, len, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RTPExternalPacketInjecter::InjectRTPorRTCP(const void *data, size_t len, const RTPAddress &a)
|
inline void RTPExternalPacketInjecter::InjectRTPorRTCP(const void *data, std::size_t len, const RTPAddress &a)
|
||||||
{
|
{
|
||||||
transmitter->InjectRTPorRTCP(data, len, a);
|
transmitter->InjectRTPorRTCP(data, len, a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ int RTPInternalSourceData::ProcessRTPPacket(RTPPacket *rtppack, const RTPTime &r
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data, size_t itemlen, const RTPTime &receivetime, bool *cnamecollis)
|
int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data, std::size_t itemlen, const RTPTime &receivetime, bool *cnamecollis)
|
||||||
{
|
{
|
||||||
*cnamecollis = false;
|
*cnamecollis = false;
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data,
|
||||||
{
|
{
|
||||||
case RTCP_SDES_ID_CNAME:
|
case RTCP_SDES_ID_CNAME:
|
||||||
{
|
{
|
||||||
size_t curlen;
|
std::size_t curlen;
|
||||||
uint8_t *oldcname;
|
uint8_t *oldcname;
|
||||||
|
|
||||||
// NOTE: we're going to make sure that the CNAME is only set once.
|
// NOTE: we're going to make sure that the CNAME is only set once.
|
||||||
|
@ -182,7 +182,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data,
|
||||||
break;
|
break;
|
||||||
case RTCP_SDES_ID_NAME:
|
case RTCP_SDES_ID_NAME:
|
||||||
{
|
{
|
||||||
size_t oldlen;
|
std::size_t oldlen;
|
||||||
|
|
||||||
SDESinf.GetName(&oldlen);
|
SDESinf.GetName(&oldlen);
|
||||||
if (oldlen == 0) // Name not set
|
if (oldlen == 0) // Name not set
|
||||||
|
@ -191,7 +191,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data,
|
||||||
break;
|
break;
|
||||||
case RTCP_SDES_ID_EMAIL:
|
case RTCP_SDES_ID_EMAIL:
|
||||||
{
|
{
|
||||||
size_t oldlen;
|
std::size_t oldlen;
|
||||||
|
|
||||||
SDESinf.GetEMail(&oldlen);
|
SDESinf.GetEMail(&oldlen);
|
||||||
if (oldlen == 0)
|
if (oldlen == 0)
|
||||||
|
@ -204,7 +204,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data,
|
||||||
return SDESinf.SetLocation(data, itemlen);
|
return SDESinf.SetLocation(data, itemlen);
|
||||||
case RTCP_SDES_ID_TOOL:
|
case RTCP_SDES_ID_TOOL:
|
||||||
{
|
{
|
||||||
size_t oldlen;
|
std::size_t oldlen;
|
||||||
|
|
||||||
SDESinf.GetTool(&oldlen);
|
SDESinf.GetTool(&oldlen);
|
||||||
if (oldlen == 0)
|
if (oldlen == 0)
|
||||||
|
@ -220,7 +220,7 @@ int RTPInternalSourceData::ProcessSDESItem(uint8_t sdesid, const uint8_t *data,
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
|
|
||||||
int RTPInternalSourceData::ProcessPrivateSDESItem(const uint8_t *prefix, size_t prefixlen, const uint8_t *value, size_t valuelen, const RTPTime &receivetime)
|
int RTPInternalSourceData::ProcessPrivateSDESItem(const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen, const RTPTime &receivetime)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ int RTPInternalSourceData::ProcessPrivateSDESItem(const uint8_t *prefix, size_t
|
||||||
|
|
||||||
#endif // RTP_SUPPORT_SDESPRIV
|
#endif // RTP_SUPPORT_SDESPRIV
|
||||||
|
|
||||||
int RTPInternalSourceData::ProcessBYEPacket(const uint8_t *reason, size_t reasonlen, const RTPTime &receivetime)
|
int RTPInternalSourceData::ProcessBYEPacket(const uint8_t *reason, std::size_t reasonlen, const RTPTime &receivetime)
|
||||||
{
|
{
|
||||||
if (byereason)
|
if (byereason)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,11 +70,11 @@ public:
|
||||||
{
|
{
|
||||||
stats.SetLastMessageTime(receivetime);
|
stats.SetLastMessageTime(receivetime);
|
||||||
}
|
}
|
||||||
int ProcessSDESItem(uint8_t sdesid, const uint8_t *data, size_t itemlen, const RTPTime &receivetime, bool *cnamecollis);
|
int ProcessSDESItem(uint8_t sdesid, const uint8_t *data, std::size_t itemlen, const RTPTime &receivetime, bool *cnamecollis);
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
int ProcessPrivateSDESItem(const uint8_t *prefix, size_t prefixlen, const uint8_t *value, size_t valuelen, const RTPTime &receivetime);
|
int ProcessPrivateSDESItem(const uint8_t *prefix, std::size_t prefixlen, const uint8_t *value, std::size_t valuelen, const RTPTime &receivetime);
|
||||||
#endif // RTP_SUPPORT_SDESPRIV
|
#endif // RTP_SUPPORT_SDESPRIV
|
||||||
int ProcessBYEPacket(const uint8_t *reason, size_t reasonlen, const RTPTime &receivetime);
|
int ProcessBYEPacket(const uint8_t *reason, std::size_t reasonlen, const RTPTime &receivetime);
|
||||||
|
|
||||||
int SetRTPDataAddress(const RTPAddress *a);
|
int SetRTPDataAddress(const RTPAddress *a);
|
||||||
int SetRTCPDataAddress(const RTPAddress *a);
|
int SetRTCPDataAddress(const RTPAddress *a);
|
||||||
|
|
|
@ -67,8 +67,8 @@ RTPPacket::RTPPacket(RTPRawPacket &rawpack) :
|
||||||
error = ParseRawPacket(rawpack);
|
error = ParseRawPacket(rawpack);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
||||||
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, size_t maxpacksize) :
|
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, std::size_t maxpacksize) :
|
||||||
receivetime(0, 0)
|
receivetime(0, 0)
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -76,8 +76,8 @@ RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloa
|
||||||
0, maxpacksize);
|
0, maxpacksize);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
||||||
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, size_t buffersize) :
|
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, std::size_t buffersize) :
|
||||||
receivetime(0, 0)
|
receivetime(0, 0)
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -93,7 +93,7 @@ RTPPacket::RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloa
|
||||||
int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
|
||||||
{
|
{
|
||||||
uint8_t *packetbytes;
|
uint8_t *packetbytes;
|
||||||
size_t packetlen;
|
std::size_t packetlen;
|
||||||
uint8_t payloadtype;
|
uint8_t payloadtype;
|
||||||
RTPHeader *rtpheader;
|
RTPHeader *rtpheader;
|
||||||
bool marker;
|
bool marker;
|
||||||
|
@ -209,8 +209,8 @@ uint32_t RTPPacket::GetCSRC(int num) const
|
||||||
return csrcval_hbo;
|
return csrcval_hbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
||||||
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, size_t maxsize)
|
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, std::size_t maxsize)
|
||||||
{
|
{
|
||||||
if (numcsrcs > RTP_MAXCSRCS)
|
if (numcsrcs > RTP_MAXCSRCS)
|
||||||
return ERR_RTP_PACKET_TOOMANYCSRCS;
|
return ERR_RTP_PACKET_TOOMANYCSRCS;
|
||||||
|
@ -221,11 +221,11 @@ int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t
|
||||||
return ERR_RTP_PACKET_BADPAYLOADTYPE;
|
return ERR_RTP_PACKET_BADPAYLOADTYPE;
|
||||||
|
|
||||||
packetlength = sizeof(RTPHeader);
|
packetlength = sizeof(RTPHeader);
|
||||||
packetlength += sizeof(uint32_t) * ((size_t) numcsrcs);
|
packetlength += sizeof(uint32_t) * ((std::size_t) numcsrcs);
|
||||||
if (gotextension)
|
if (gotextension)
|
||||||
{
|
{
|
||||||
packetlength += sizeof(RTPExtensionHeader);
|
packetlength += sizeof(RTPExtensionHeader);
|
||||||
packetlength += sizeof(uint32_t) * ((size_t) extensionlen_numwords);
|
packetlength += sizeof(uint32_t) * ((std::size_t) extensionlen_numwords);
|
||||||
}
|
}
|
||||||
packetlength += payloadlen;
|
packetlength += payloadlen;
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t
|
||||||
RTPPacket::ssrc = ssrc;
|
RTPPacket::ssrc = ssrc;
|
||||||
RTPPacket::payloadlength = payloadlen;
|
RTPPacket::payloadlength = payloadlen;
|
||||||
RTPPacket::extid = extensionid;
|
RTPPacket::extid = extensionid;
|
||||||
RTPPacket::extensionlength = ((size_t) extensionlen_numwords) * sizeof(uint32_t);
|
RTPPacket::extensionlength = ((std::size_t) extensionlen_numwords) * sizeof(uint32_t);
|
||||||
|
|
||||||
rtphdr = (RTPHeader *) packet;
|
rtphdr = (RTPHeader *) packet;
|
||||||
rtphdr->version = RTP_VERSION;
|
rtphdr->version = RTP_VERSION;
|
||||||
|
@ -290,7 +290,7 @@ int RTPPacket::BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t
|
||||||
for (i = 0; i < numcsrcs; i++, curcsrc++)
|
for (i = 0; i < numcsrcs; i++, curcsrc++)
|
||||||
*curcsrc = qToBigEndian(csrcs[i]);
|
*curcsrc = qToBigEndian(csrcs[i]);
|
||||||
|
|
||||||
payload = packet + sizeof(RTPHeader) + ((size_t) numcsrcs) * sizeof(uint32_t);
|
payload = packet + sizeof(RTPHeader) + ((std::size_t) numcsrcs) * sizeof(uint32_t);
|
||||||
if (gotextension)
|
if (gotextension)
|
||||||
{
|
{
|
||||||
RTPExtensionHeader *rtpexthdr = (RTPExtensionHeader *) payload;
|
RTPExtensionHeader *rtpexthdr = (RTPExtensionHeader *) payload;
|
||||||
|
|
|
@ -68,13 +68,13 @@ public:
|
||||||
* \c maxpacksize. The arguments of the constructor are self-explanatory. Note that the size of a header
|
* \c maxpacksize. The arguments of the constructor are self-explanatory. Note that the size of a header
|
||||||
* extension is specified in a number of 32-bit words. A memory manager can be installed.
|
* extension is specified in a number of 32-bit words. A memory manager can be installed.
|
||||||
*/
|
*/
|
||||||
RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
RTPPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
||||||
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, size_t maxpacksize);
|
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, std::size_t maxpacksize);
|
||||||
|
|
||||||
/** This constructor is similar to the other constructor, but here data is stored in an external buffer
|
/** This constructor is similar to the other constructor, but here data is stored in an external buffer
|
||||||
* \c buffer with size \c buffersize. */
|
* \c buffer with size \c buffersize. */
|
||||||
RTPPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
RTPPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
||||||
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, size_t buffersize);
|
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, std::size_t buffersize);
|
||||||
|
|
||||||
virtual ~RTPPacket()
|
virtual ~RTPPacket()
|
||||||
{
|
{
|
||||||
|
@ -163,13 +163,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the length of the entire packet. */
|
/** Returns the length of the entire packet. */
|
||||||
size_t GetPacketLength() const
|
std::size_t GetPacketLength() const
|
||||||
{
|
{
|
||||||
return packetlength;
|
return packetlength;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the payload length. */
|
/** Returns the payload length. */
|
||||||
size_t GetPayloadLength() const
|
std::size_t GetPayloadLength() const
|
||||||
{
|
{
|
||||||
return payloadlength;
|
return payloadlength;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the length of the header extension data. */
|
/** Returns the length of the header extension data. */
|
||||||
size_t GetExtensionLength() const
|
std::size_t GetExtensionLength() const
|
||||||
{
|
{
|
||||||
return extensionlength;
|
return extensionlength;
|
||||||
}
|
}
|
||||||
|
@ -204,8 +204,8 @@ public:
|
||||||
private:
|
private:
|
||||||
void Clear();
|
void Clear();
|
||||||
int ParseRawPacket(RTPRawPacket &rawpack);
|
int ParseRawPacket(RTPRawPacket &rawpack);
|
||||||
int BuildPacket(uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
int BuildPacket(uint8_t payloadtype, const void *payloaddata, std::size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs,
|
||||||
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, size_t maxsize);
|
const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, std::size_t maxsize);
|
||||||
|
|
||||||
RTPEndian m_endian;
|
RTPEndian m_endian;
|
||||||
int error;
|
int error;
|
||||||
|
@ -216,11 +216,11 @@ private:
|
||||||
uint8_t payloadtype;
|
uint8_t payloadtype;
|
||||||
uint32_t extseqnr, timestamp, ssrc;
|
uint32_t extseqnr, timestamp, ssrc;
|
||||||
uint8_t *packet, *payload;
|
uint8_t *packet, *payload;
|
||||||
size_t packetlength, payloadlength;
|
std::size_t packetlength, payloadlength;
|
||||||
|
|
||||||
uint16_t extid;
|
uint16_t extid;
|
||||||
uint8_t *extension;
|
uint8_t *extension;
|
||||||
size_t extensionlength;
|
std::size_t extensionlength;
|
||||||
|
|
||||||
bool externalbuffer;
|
bool externalbuffer;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ RTPPacketBuilder::~RTPPacketBuilder()
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPPacketBuilder::Init(size_t max)
|
int RTPPacketBuilder::Init(std::size_t max)
|
||||||
{
|
{
|
||||||
if (init)
|
if (init)
|
||||||
return ERR_RTP_PACKBUILD_ALREADYINIT;
|
return ERR_RTP_PACKBUILD_ALREADYINIT;
|
||||||
|
@ -87,7 +87,7 @@ void RTPPacketBuilder::Destroy()
|
||||||
init = false;
|
init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPPacketBuilder::SetMaximumPacketSize(size_t max)
|
int RTPPacketBuilder::SetMaximumPacketSize(std::size_t max)
|
||||||
{
|
{
|
||||||
uint8_t *newbuf;
|
uint8_t *newbuf;
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ uint32_t RTPPacketBuilder::CreateNewSSRC(RTPSources &sources)
|
||||||
return ssrc;
|
return ssrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPPacketBuilder::BuildPacket(const void *data, size_t len)
|
int RTPPacketBuilder::BuildPacket(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_PACKBUILD_NOTINIT;
|
return ERR_RTP_PACKBUILD_NOTINIT;
|
||||||
|
@ -199,14 +199,14 @@ int RTPPacketBuilder::BuildPacket(const void *data, size_t len)
|
||||||
return PrivateBuildPacket(data, len, defaultpayloadtype, defaultmark, defaulttimestampinc, false);
|
return PrivateBuildPacket(data, len, defaultpayloadtype, defaultmark, defaulttimestampinc, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPPacketBuilder::BuildPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc)
|
int RTPPacketBuilder::BuildPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_PACKBUILD_NOTINIT;
|
return ERR_RTP_PACKBUILD_NOTINIT;
|
||||||
return PrivateBuildPacket(data, len, pt, mark, timestampinc, false);
|
return PrivateBuildPacket(data, len, pt, mark, timestampinc, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPPacketBuilder::BuildPacketEx(const void *data, size_t len, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords)
|
int RTPPacketBuilder::BuildPacketEx(const void *data, std::size_t len, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_PACKBUILD_NOTINIT;
|
return ERR_RTP_PACKBUILD_NOTINIT;
|
||||||
|
@ -219,7 +219,7 @@ int RTPPacketBuilder::BuildPacketEx(const void *data, size_t len, uint16_t hdrex
|
||||||
return PrivateBuildPacket(data, len, defaultpayloadtype, defaultmark, defaulttimestampinc, true, hdrextID, hdrextdata, numhdrextwords);
|
return PrivateBuildPacket(data, len, defaultpayloadtype, defaultmark, defaulttimestampinc, true, hdrextID, hdrextdata, numhdrextwords);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPPacketBuilder::BuildPacketEx(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords)
|
int RTPPacketBuilder::BuildPacketEx(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_PACKBUILD_NOTINIT;
|
return ERR_RTP_PACKBUILD_NOTINIT;
|
||||||
|
@ -227,8 +227,8 @@ int RTPPacketBuilder::BuildPacketEx(const void *data, size_t len, uint8_t pt, bo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPPacketBuilder::PrivateBuildPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, bool gotextension, uint16_t hdrextID, const void *hdrextdata,
|
int RTPPacketBuilder::PrivateBuildPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, bool gotextension, uint16_t hdrextID, const void *hdrextdata,
|
||||||
size_t numhdrextwords)
|
std::size_t numhdrextwords)
|
||||||
{
|
{
|
||||||
RTPPacket p(pt, data, len, seqnr, timestamp, ssrc, mark, numcsrcs, csrcs, gotextension, hdrextID, (uint16_t) numhdrextwords, hdrextdata, buffer, maxpacksize);
|
RTPPacket p(pt, data, len, seqnr, timestamp, ssrc, mark, numcsrcs, csrcs, gotextension, hdrextID, (uint16_t) numhdrextwords, hdrextdata, buffer, maxpacksize);
|
||||||
int status = p.GetCreationError();
|
int status = p.GetCreationError();
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
~RTPPacketBuilder();
|
~RTPPacketBuilder();
|
||||||
|
|
||||||
/** Initializes the builder to only allow packets with a size below \c maxpacksize. */
|
/** Initializes the builder to only allow packets with a size below \c maxpacksize. */
|
||||||
int Init(size_t maxpacksize);
|
int Init(std::size_t maxpacksize);
|
||||||
|
|
||||||
/** Cleans up the builder. */
|
/** Cleans up the builder. */
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the maximum allowed packet size to \c maxpacksize. */
|
/** Sets the maximum allowed packet size to \c maxpacksize. */
|
||||||
int SetMaximumPacketSize(size_t maxpacksize);
|
int SetMaximumPacketSize(std::size_t maxpacksize);
|
||||||
|
|
||||||
/** Adds a CSRC to the CSRC list which will be stored in the RTP packets. */
|
/** Adds a CSRC to the CSRC list which will be stored in the RTP packets. */
|
||||||
int AddCSRC(uint32_t csrc);
|
int AddCSRC(uint32_t csrc);
|
||||||
|
@ -101,14 +101,14 @@ public:
|
||||||
* and timestamp increment used will be those that have been set using the \c SetDefault
|
* and timestamp increment used will be those that have been set using the \c SetDefault
|
||||||
* functions below.
|
* functions below.
|
||||||
*/
|
*/
|
||||||
int BuildPacket(const void *data, size_t len);
|
int BuildPacket(const void *data, std::size_t len);
|
||||||
|
|
||||||
/** Builds a packet with payload \c data and payload length \c len.
|
/** Builds a packet with payload \c data and payload length \c len.
|
||||||
* Builds a packet with payload \c data and payload length \c len. The payload type will be
|
* Builds a packet with payload \c data and payload length \c len. The payload type will be
|
||||||
* set to \c pt, the marker bit to \c mark and after building this packet, the timestamp will
|
* set to \c pt, the marker bit to \c mark and after building this packet, the timestamp will
|
||||||
* be incremented with \c timestamp.
|
* be incremented with \c timestamp.
|
||||||
*/
|
*/
|
||||||
int BuildPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc);
|
int BuildPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc);
|
||||||
|
|
||||||
/** Builds a packet with payload \c data and payload length \c len.
|
/** Builds a packet with payload \c data and payload length \c len.
|
||||||
* Builds a packet with payload \c data and payload length \c len. The payload type, marker
|
* Builds a packet with payload \c data and payload length \c len. The payload type, marker
|
||||||
|
@ -117,7 +117,7 @@ public:
|
||||||
* \c hdrextID and data \c hdrextdata. The length of the header extension data is given by
|
* \c hdrextID and data \c hdrextdata. The length of the header extension data is given by
|
||||||
* \c numhdrextwords which expresses the length in a number of 32-bit words.
|
* \c numhdrextwords which expresses the length in a number of 32-bit words.
|
||||||
*/
|
*/
|
||||||
int BuildPacketEx(const void *data, size_t len, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords);
|
int BuildPacketEx(const void *data, std::size_t len, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords);
|
||||||
|
|
||||||
/** Builds a packet with payload \c data and payload length \c len.
|
/** Builds a packet with payload \c data and payload length \c len.
|
||||||
* Builds a packet with payload \c data and payload length \c len. The payload type will be set
|
* Builds a packet with payload \c data and payload length \c len. The payload type will be set
|
||||||
|
@ -126,7 +126,7 @@ public:
|
||||||
* with identifier \c hdrextID and data \c hdrextdata. The length of the header extension
|
* with identifier \c hdrextID and data \c hdrextdata. The length of the header extension
|
||||||
* data is given by \c numhdrextwords which expresses the length in a number of 32-bit words.
|
* data is given by \c numhdrextwords which expresses the length in a number of 32-bit words.
|
||||||
*/
|
*/
|
||||||
int BuildPacketEx(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords);
|
int BuildPacketEx(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords);
|
||||||
|
|
||||||
/** Returns a pointer to the last built RTP packet data. */
|
/** Returns a pointer to the last built RTP packet data. */
|
||||||
uint8_t *GetPacket()
|
uint8_t *GetPacket()
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the size of the last built RTP packet. */
|
/** Returns the size of the last built RTP packet. */
|
||||||
size_t GetPacketLength()
|
std::size_t GetPacketLength()
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -235,13 +235,13 @@ public:
|
||||||
ssrc = s;
|
ssrc = s;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
int PrivateBuildPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, bool gotextension, uint16_t hdrextID = 0, const void *hdrextdata = 0,
|
int PrivateBuildPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, bool gotextension, uint16_t hdrextID = 0, const void *hdrextdata = 0,
|
||||||
size_t numhdrextwords = 0);
|
std::size_t numhdrextwords = 0);
|
||||||
|
|
||||||
RTPRandom &rtprnd;
|
RTPRandom &rtprnd;
|
||||||
size_t maxpacksize;
|
std::size_t maxpacksize;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
size_t packetlength;
|
std::size_t packetlength;
|
||||||
|
|
||||||
uint32_t numpayloadbytes;
|
uint32_t numpayloadbytes;
|
||||||
uint32_t numpackets;
|
uint32_t numpackets;
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
* The flag which indicates whether this data is RTP or RTCP data is set to \c rtp. A memory
|
* The flag which indicates whether this data is RTP or RTCP data is set to \c rtp. A memory
|
||||||
* manager can be installed as well.
|
* manager can be installed as well.
|
||||||
*/
|
*/
|
||||||
RTPRawPacket(uint8_t *data, size_t datalen, RTPAddress *address, RTPTime &recvtime, bool rtp);
|
RTPRawPacket(uint8_t *data, std::size_t datalen, RTPAddress *address, RTPTime &recvtime, bool rtp);
|
||||||
~RTPRawPacket();
|
~RTPRawPacket();
|
||||||
|
|
||||||
/** Returns the pointer to the data which is contained in this packet. */
|
/** Returns the pointer to the data which is contained in this packet. */
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the length of the packet described by this instance. */
|
/** Returns the length of the packet described by this instance. */
|
||||||
size_t GetDataLength() const
|
std::size_t GetDataLength() const
|
||||||
{
|
{
|
||||||
return packetdatalength;
|
return packetdatalength;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public:
|
||||||
|
|
||||||
/** Deallocates the previously stored data and replaces it with the data that's
|
/** Deallocates the previously stored data and replaces it with the data that's
|
||||||
* specified, can be useful when e.g. decrypting data in RTPSession::OnChangeIncomingData */
|
* specified, can be useful when e.g. decrypting data in RTPSession::OnChangeIncomingData */
|
||||||
void SetData(uint8_t *data, size_t datalen);
|
void SetData(uint8_t *data, std::size_t datalen);
|
||||||
|
|
||||||
/** Deallocates the currently stored RTPAddress instance and replaces it
|
/** Deallocates the currently stored RTPAddress instance and replaces it
|
||||||
* with the one that's specified (you probably don't need this function). */
|
* with the one that's specified (you probably don't need this function). */
|
||||||
|
@ -119,13 +119,13 @@ private:
|
||||||
void DeleteData();
|
void DeleteData();
|
||||||
|
|
||||||
uint8_t *packetdata;
|
uint8_t *packetdata;
|
||||||
size_t packetdatalength;
|
std::size_t packetdatalength;
|
||||||
RTPTime receivetime;
|
RTPTime receivetime;
|
||||||
RTPAddress *senderaddress;
|
RTPAddress *senderaddress;
|
||||||
bool isrtp;
|
bool isrtp;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline RTPRawPacket::RTPRawPacket(uint8_t *data, size_t datalen, RTPAddress *address, RTPTime &recvtime, bool rtp) :
|
inline RTPRawPacket::RTPRawPacket(uint8_t *data, std::size_t datalen, RTPAddress *address, RTPTime &recvtime, bool rtp) :
|
||||||
receivetime(recvtime)
|
receivetime(recvtime)
|
||||||
{
|
{
|
||||||
packetdata = data;
|
packetdata = data;
|
||||||
|
@ -155,7 +155,7 @@ inline uint8_t *RTPRawPacket::AllocateBytes(int recvlen) const
|
||||||
return new uint8_t[recvlen];
|
return new uint8_t[recvlen];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RTPRawPacket::SetData(uint8_t *data, size_t datalen)
|
inline void RTPRawPacket::SetData(uint8_t *data, std::size_t datalen)
|
||||||
{
|
{
|
||||||
if (packetdata)
|
if (packetdata)
|
||||||
delete[] packetdata;
|
delete[] packetdata;
|
||||||
|
|
|
@ -57,13 +57,13 @@
|
||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
|
||||||
inline int RTPSelect(const SocketType *sockets, int8_t *readflags, size_t numsocks, RTPTime timeout)
|
inline int RTPSelect(const SocketType *sockets, int8_t *readflags, std::size_t numsocks, RTPTime timeout)
|
||||||
{
|
{
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
vector<struct pollfd> fds(numsocks);
|
vector<struct pollfd> fds(numsocks);
|
||||||
|
|
||||||
for (size_t i = 0; i < numsocks; i++)
|
for (std::size_t i = 0; i < numsocks; i++)
|
||||||
{
|
{
|
||||||
fds[i].fd = sockets[i];
|
fds[i].fd = sockets[i];
|
||||||
fds[i].events = POLLIN;
|
fds[i].events = POLLIN;
|
||||||
|
@ -98,7 +98,7 @@ inline int RTPSelect(const SocketType *sockets, int8_t *readflags, size_t numsoc
|
||||||
|
|
||||||
if (status > 0)
|
if (status > 0)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < numsocks; i++)
|
for (std::size_t i = 0; i < numsocks; i++)
|
||||||
{
|
{
|
||||||
if (fds[i].revents)
|
if (fds[i].revents)
|
||||||
readflags[i] = 1;
|
readflags[i] = 1;
|
||||||
|
@ -131,7 +131,7 @@ namespace qrtplib
|
||||||
* indefinitely if set to a negative value. The function returns the number
|
* indefinitely if set to a negative value. The function returns the number
|
||||||
* of sockets that have data incoming.
|
* of sockets that have data incoming.
|
||||||
*/
|
*/
|
||||||
inline int RTPSelect(const SocketType *sockets, int8_t *readflags, size_t numsocks, RTPTime timeout)
|
inline int RTPSelect(const SocketType *sockets, int8_t *readflags, std::size_t numsocks, RTPTime timeout)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct timeval *pTv = 0;
|
struct timeval *pTv = 0;
|
||||||
|
@ -145,7 +145,7 @@ namespace qrtplib
|
||||||
|
|
||||||
fd_set fdset;
|
fd_set fdset;
|
||||||
FD_ZERO(&fdset);
|
FD_ZERO(&fdset);
|
||||||
for (size_t i = 0; i < numsocks; i++)
|
for (std::size_t i = 0; i < numsocks; i++)
|
||||||
{
|
{
|
||||||
#ifndef RTP_SOCKETTYPE_WINSOCK
|
#ifndef RTP_SOCKETTYPE_WINSOCK
|
||||||
const int setsize = FD_SETSIZE;
|
const int setsize = FD_SETSIZE;
|
||||||
|
@ -174,7 +174,7 @@ namespace qrtplib
|
||||||
|
|
||||||
if (status > 0) // some descriptors were set, check them
|
if (status > 0) // some descriptors were set, check them
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < numsocks; i++)
|
for (std::size_t i = 0; i < numsocks; i++)
|
||||||
{
|
{
|
||||||
if (FD_ISSET(sockets[i], &fdset))
|
if (FD_ISSET(sockets[i], &fdset))
|
||||||
readflags[i] = 1;
|
readflags[i] = 1;
|
||||||
|
|
|
@ -220,7 +220,7 @@ int RTPSession::InternalCreate(const RTPSessionParams &sessparams)
|
||||||
|
|
||||||
double timestampunit = sessparams.GetOwnTimestampUnit();
|
double timestampunit = sessparams.GetOwnTimestampUnit();
|
||||||
uint8_t buf[1024];
|
uint8_t buf[1024];
|
||||||
size_t buflen = 1024;
|
std::size_t buflen = 1024;
|
||||||
std::string forcedcname = sessparams.GetCNAME();
|
std::string forcedcname = sessparams.GetCNAME();
|
||||||
|
|
||||||
if (forcedcname.length() == 0)
|
if (forcedcname.length() == 0)
|
||||||
|
@ -329,7 +329,7 @@ void RTPSession::Destroy()
|
||||||
created = false;
|
created = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPSession::BYEDestroy(const RTPTime &maxwaittime, const void *reason, size_t reasonlength)
|
void RTPSession::BYEDestroy(const RTPTime &maxwaittime, const void *reason, std::size_t reasonlength)
|
||||||
{
|
{
|
||||||
if (!created)
|
if (!created)
|
||||||
return;
|
return;
|
||||||
|
@ -474,7 +474,7 @@ void RTPSession::LeaveAllMulticastGroups()
|
||||||
rtptrans->LeaveAllMulticastGroups();
|
rtptrans->LeaveAllMulticastGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SendPacket(const void *data, size_t len)
|
int RTPSession::SendPacket(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ int RTPSession::SendPacket(const void *data, size_t len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SendPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc)
|
int RTPSession::SendPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ int RTPSession::SendPacket(const void *data, size_t len, uint8_t pt, bool mark,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SendPacketEx(const void *data, size_t len, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords)
|
int RTPSession::SendPacketEx(const void *data, std::size_t len, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ int RTPSession::SendPacketEx(const void *data, size_t len, uint16_t hdrextID, co
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SendPacketEx(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords)
|
int RTPSession::SendPacketEx(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -592,7 +592,7 @@ int RTPSession::SendPacketEx(const void *data, size_t len, uint8_t pt, bool mark
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_SENDAPP
|
#ifdef RTP_SUPPORT_SENDAPP
|
||||||
|
|
||||||
int RTPSession::SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, size_t appdatalen)
|
int RTPSession::SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, std::size_t appdatalen)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ int RTPSession::SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
BUILDER_LOCK
|
BUILDER_LOCK
|
||||||
size_t owncnamelen = 0;
|
std::size_t owncnamelen = 0;
|
||||||
uint8_t *owncname = rtcpbuilder.GetLocalCNAME(&owncnamelen);
|
uint8_t *owncname = rtcpbuilder.GetLocalCNAME(&owncnamelen);
|
||||||
|
|
||||||
if ((status = pb.AddSDESNormalItem(RTCPSDESPacket::CNAME, owncname, owncnamelen)) < 0)
|
if ((status = pb.AddSDESNormalItem(RTCPSDESPacket::CNAME, owncname, owncnamelen)) < 0)
|
||||||
|
@ -650,7 +650,7 @@ int RTPSession::SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const
|
||||||
|
|
||||||
#endif // RTP_SUPPORT_SENDAPP
|
#endif // RTP_SUPPORT_SENDAPP
|
||||||
|
|
||||||
int RTPSession::SendRawData(const void *data, size_t len, bool usertpchannel)
|
int RTPSession::SendRawData(const void *data, std::size_t len, bool usertpchannel)
|
||||||
{
|
{
|
||||||
if (!created)
|
if (!created)
|
||||||
return ERR_RTP_SESSION_NOTCREATED;
|
return ERR_RTP_SESSION_NOTCREATED;
|
||||||
|
@ -940,7 +940,7 @@ void RTPSession::ClearAcceptList()
|
||||||
rtptrans->ClearAcceptList();
|
rtptrans->ClearAcceptList();
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SetMaximumPacketSize(size_t s)
|
int RTPSession::SetMaximumPacketSize(std::size_t s)
|
||||||
{
|
{
|
||||||
if (!created)
|
if (!created)
|
||||||
return ERR_RTP_SESSION_NOTCREATED;
|
return ERR_RTP_SESSION_NOTCREATED;
|
||||||
|
@ -1059,7 +1059,7 @@ rtcpbuilder.SetNoteInterval(count);
|
||||||
BUILDER_UNLOCK
|
BUILDER_UNLOCK
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SetLocalName(const void *s, size_t len)
|
int RTPSession::SetLocalName(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!created)
|
if (!created)
|
||||||
return ERR_RTP_SESSION_NOTCREATED;
|
return ERR_RTP_SESSION_NOTCREATED;
|
||||||
|
@ -1071,7 +1071,7 @@ BUILDER_UNLOCK
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SetLocalEMail(const void *s, size_t len)
|
int RTPSession::SetLocalEMail(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!created)
|
if (!created)
|
||||||
return ERR_RTP_SESSION_NOTCREATED;
|
return ERR_RTP_SESSION_NOTCREATED;
|
||||||
|
@ -1083,7 +1083,7 @@ BUILDER_UNLOCK
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SetLocalLocation(const void *s, size_t len)
|
int RTPSession::SetLocalLocation(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!created)
|
if (!created)
|
||||||
return ERR_RTP_SESSION_NOTCREATED;
|
return ERR_RTP_SESSION_NOTCREATED;
|
||||||
|
@ -1095,7 +1095,7 @@ BUILDER_UNLOCK
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SetLocalPhone(const void *s, size_t len)
|
int RTPSession::SetLocalPhone(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!created)
|
if (!created)
|
||||||
return ERR_RTP_SESSION_NOTCREATED;
|
return ERR_RTP_SESSION_NOTCREATED;
|
||||||
|
@ -1107,7 +1107,7 @@ BUILDER_UNLOCK
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SetLocalTool(const void *s, size_t len)
|
int RTPSession::SetLocalTool(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!created)
|
if (!created)
|
||||||
return ERR_RTP_SESSION_NOTCREATED;
|
return ERR_RTP_SESSION_NOTCREATED;
|
||||||
|
@ -1119,7 +1119,7 @@ BUILDER_UNLOCK
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SetLocalNote(const void *s, size_t len)
|
int RTPSession::SetLocalNote(const void *s, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!created)
|
if (!created)
|
||||||
return ERR_RTP_SESSION_NOTCREATED;
|
return ERR_RTP_SESSION_NOTCREATED;
|
||||||
|
@ -1321,7 +1321,7 @@ SOURCES_UNLOCK
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::CreateCNAME(uint8_t *buffer, size_t *bufferlength, bool resolve)
|
int RTPSession::CreateCNAME(uint8_t *buffer, std::size_t *bufferlength, bool resolve)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
bool gotlogin = true;
|
bool gotlogin = true;
|
||||||
|
@ -1370,12 +1370,12 @@ RTP_STRNCPY((char *)buffer,"unknown",*bufferlength);
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
buffer[*bufferlength - 1] = 0;
|
buffer[*bufferlength - 1] = 0;
|
||||||
|
|
||||||
size_t offset = strlen((const char *) buffer);
|
std::size_t offset = strlen((const char *) buffer);
|
||||||
if (offset < (*bufferlength - 1))
|
if (offset < (*bufferlength - 1))
|
||||||
buffer[offset] = (uint8_t) '@';
|
buffer[offset] = (uint8_t) '@';
|
||||||
offset++;
|
offset++;
|
||||||
|
|
||||||
size_t buflen2 = *bufferlength - offset;
|
std::size_t buflen2 = *bufferlength - offset;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (resolve)
|
if (resolve)
|
||||||
|
@ -1418,13 +1418,13 @@ deletertprnd = false;
|
||||||
return rnew;
|
return rnew;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SendRTPData(const void *data, size_t len)
|
int RTPSession::SendRTPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!m_changeOutgoingData)
|
if (!m_changeOutgoingData)
|
||||||
return rtptrans->SendRTPData(data, len);
|
return rtptrans->SendRTPData(data, len);
|
||||||
|
|
||||||
void *pSendData = 0;
|
void *pSendData = 0;
|
||||||
size_t sendLen = 0;
|
std::size_t sendLen = 0;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
status = OnChangeRTPOrRTCPData(data, len, true, &pSendData, &sendLen);
|
status = OnChangeRTPOrRTCPData(data, len, true, &pSendData, &sendLen);
|
||||||
|
@ -1440,13 +1440,13 @@ OnSentRTPOrRTCPData(pSendData, sendLen, true);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSession::SendRTCPData(const void *data, size_t len)
|
int RTPSession::SendRTCPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!m_changeOutgoingData)
|
if (!m_changeOutgoingData)
|
||||||
return rtptrans->SendRTCPData(data, len);
|
return rtptrans->SendRTCPData(data, len);
|
||||||
|
|
||||||
void *pSendData = 0;
|
void *pSendData = 0;
|
||||||
size_t sendLen = 0;
|
std::size_t sendLen = 0;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
status = OnChangeRTPOrRTCPData(data, len, false, &pSendData, &sendLen);
|
status = OnChangeRTPOrRTCPData(data, len, false, &pSendData, &sendLen);
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
* send the BYE packet. If this time expires, the session will be left without sending a BYE packet.
|
* send the BYE packet. If this time expires, the session will be left without sending a BYE packet.
|
||||||
* The BYE packet will contain as reason for leaving \c reason with length \c reasonlength.
|
* The BYE packet will contain as reason for leaving \c reason with length \c reasonlength.
|
||||||
*/
|
*/
|
||||||
void BYEDestroy(const RTPTime &maxwaittime, const void *reason, size_t reasonlength);
|
void BYEDestroy(const RTPTime &maxwaittime, const void *reason, std::size_t reasonlength);
|
||||||
|
|
||||||
/** Returns whether the session has been created or not. */
|
/** Returns whether the session has been created or not. */
|
||||||
bool IsActive();
|
bool IsActive();
|
||||||
|
@ -146,13 +146,13 @@ public:
|
||||||
* The used payload type, marker and timestamp increment will be those that have been set
|
* The used payload type, marker and timestamp increment will be those that have been set
|
||||||
* using the \c SetDefault member functions.
|
* using the \c SetDefault member functions.
|
||||||
*/
|
*/
|
||||||
int SendPacket(const void *data, size_t len);
|
int SendPacket(const void *data, std::size_t len);
|
||||||
|
|
||||||
/** Sends the RTP packet with payload \c data which has length \c len.
|
/** Sends the RTP packet with payload \c data which has length \c len.
|
||||||
* It will use payload type \c pt, marker \c mark and after the packet has been built, the
|
* It will use payload type \c pt, marker \c mark and after the packet has been built, the
|
||||||
* timestamp will be incremented by \c timestampinc.
|
* timestamp will be incremented by \c timestampinc.
|
||||||
*/
|
*/
|
||||||
int SendPacket(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc);
|
int SendPacket(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc);
|
||||||
|
|
||||||
/** Sends the RTP packet with payload \c data which has length \c len.
|
/** Sends the RTP packet with payload \c data which has length \c len.
|
||||||
* The packet will contain a header extension with identifier \c hdrextID and containing data
|
* The packet will contain a header extension with identifier \c hdrextID and containing data
|
||||||
|
@ -160,7 +160,7 @@ public:
|
||||||
* number of 32-bit words. The used payload type, marker and timestamp increment will be those that
|
* number of 32-bit words. The used payload type, marker and timestamp increment will be those that
|
||||||
* have been set using the \c SetDefault member functions.
|
* have been set using the \c SetDefault member functions.
|
||||||
*/
|
*/
|
||||||
int SendPacketEx(const void *data, size_t len, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords);
|
int SendPacketEx(const void *data, std::size_t len, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords);
|
||||||
|
|
||||||
/** Sends the RTP packet with payload \c data which has length \c len.
|
/** Sends the RTP packet with payload \c data which has length \c len.
|
||||||
* It will use payload type \c pt, marker \c mark and after the packet has been built, the
|
* It will use payload type \c pt, marker \c mark and after the packet has been built, the
|
||||||
|
@ -168,7 +168,7 @@ public:
|
||||||
* extension with identifier \c hdrextID and containing data \c hdrextdata. The length
|
* extension with identifier \c hdrextID and containing data \c hdrextdata. The length
|
||||||
* of this data is given by \c numhdrextwords and is specified in a number of 32-bit words.
|
* of this data is given by \c numhdrextwords and is specified in a number of 32-bit words.
|
||||||
*/
|
*/
|
||||||
int SendPacketEx(const void *data, size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, size_t numhdrextwords);
|
int SendPacketEx(const void *data, std::size_t len, uint8_t pt, bool mark, uint32_t timestampinc, uint16_t hdrextID, const void *hdrextdata, std::size_t numhdrextwords);
|
||||||
#ifdef RTP_SUPPORT_SENDAPP
|
#ifdef RTP_SUPPORT_SENDAPP
|
||||||
/** If sending of RTCP APP packets was enabled at compile time, this function creates a compound packet
|
/** If sending of RTCP APP packets was enabled at compile time, this function creates a compound packet
|
||||||
* containing an RTCP APP packet and sends it immediately.
|
* containing an RTCP APP packet and sends it immediately.
|
||||||
|
@ -177,13 +177,13 @@ public:
|
||||||
* of bytes in the RTCP compound packet. Note that this immediate sending is not compliant with the RTP
|
* of bytes in the RTCP compound packet. Note that this immediate sending is not compliant with the RTP
|
||||||
* specification, so use with care.
|
* specification, so use with care.
|
||||||
*/
|
*/
|
||||||
int SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, size_t appdatalen);
|
int SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, std::size_t appdatalen);
|
||||||
#endif // RTP_SUPPORT_SENDAPP
|
#endif // RTP_SUPPORT_SENDAPP
|
||||||
|
|
||||||
/** With this function raw data can be sent directly over the RTP or
|
/** With this function raw data can be sent directly over the RTP or
|
||||||
* RTCP channel (if they are different); the data is **not** passed through the
|
* RTCP channel (if they are different); the data is **not** passed through the
|
||||||
* RTPSession::OnChangeRTPOrRTCPData function. */
|
* RTPSession::OnChangeRTPOrRTCPData function. */
|
||||||
int SendRawData(const void *data, size_t len, bool usertpchannel);
|
int SendRawData(const void *data, std::size_t len, bool usertpchannel);
|
||||||
|
|
||||||
/** Sets the default payload type for RTP packets to \c pt. */
|
/** Sets the default payload type for RTP packets to \c pt. */
|
||||||
int SetDefaultPayloadType(uint8_t pt);
|
int SetDefaultPayloadType(uint8_t pt);
|
||||||
|
@ -353,7 +353,7 @@ public:
|
||||||
void ClearAcceptList();
|
void ClearAcceptList();
|
||||||
|
|
||||||
/** Sets the maximum allowed packet size to \c s. */
|
/** Sets the maximum allowed packet size to \c s. */
|
||||||
int SetMaximumPacketSize(size_t s);
|
int SetMaximumPacketSize(std::size_t s);
|
||||||
|
|
||||||
/** Sets the session bandwidth to \c bw, which is specified in bytes per second. */
|
/** Sets the session bandwidth to \c bw, which is specified in bytes per second. */
|
||||||
int SetSessionBandwidth(double bw);
|
int SetSessionBandwidth(double bw);
|
||||||
|
@ -415,22 +415,22 @@ public:
|
||||||
void SetNoteInterval(int count);
|
void SetNoteInterval(int count);
|
||||||
|
|
||||||
/** Sets the SDES name item for the local participant to the value \c s with length \c len. */
|
/** 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);
|
int SetLocalName(const void *s, std::size_t len);
|
||||||
|
|
||||||
/** Sets the SDES e-mail item for the local participant to the value \c s with length \c 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);
|
int SetLocalEMail(const void *s, std::size_t len);
|
||||||
|
|
||||||
/** Sets the SDES location item for the local participant to the value \c s with length \c 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);
|
int SetLocalLocation(const void *s, std::size_t len);
|
||||||
|
|
||||||
/** Sets the SDES phone item for the local participant to the value \c s with length \c 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);
|
int SetLocalPhone(const void *s, std::size_t len);
|
||||||
|
|
||||||
/** Sets the SDES tool item for the local participant to the value \c s with length \c 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);
|
int SetLocalTool(const void *s, std::size_t len);
|
||||||
|
|
||||||
/** Sets the SDES note item for the local participant to the value \c s with length \c 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);
|
int SetLocalNote(const void *s, std::size_t len);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Allocate a user defined transmitter.
|
/** Allocate a user defined transmitter.
|
||||||
|
@ -461,7 +461,7 @@ protected:
|
||||||
virtual void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp);
|
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. */
|
/** 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);
|
virtual void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, std::size_t cnamelength);
|
||||||
|
|
||||||
/** Is called when a new entry \c srcdat is added to the source table. */
|
/** Is called when a new entry \c srcdat is added to the source table. */
|
||||||
virtual void OnNewSource(RTPSourceData *srcdat);
|
virtual void OnNewSource(RTPSourceData *srcdat);
|
||||||
|
@ -496,10 +496,10 @@ protected:
|
||||||
virtual void OnRTCPReceiverReport(RTPSourceData *srcdat);
|
virtual void OnRTCPReceiverReport(RTPSourceData *srcdat);
|
||||||
|
|
||||||
/** Is called when a specific SDES item was received for this source. */
|
/** Is called when a specific SDES item was received for this source. */
|
||||||
virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, size_t itemlength);
|
virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, std::size_t itemlength);
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
/** Is called when a specific SDES item of 'private' type was received for this source. */
|
/** Is called when a specific SDES item of 'private' type was received for this source. */
|
||||||
virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, const void *valuedata, size_t valuelen);
|
virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, std::size_t prefixlen, const void *valuedata, std::size_t valuelen);
|
||||||
#endif // RTP_SUPPORT_SDESPRIV
|
#endif // RTP_SUPPORT_SDESPRIV
|
||||||
|
|
||||||
/** Is called when a BYE packet has been processed for source \c srcdat. */
|
/** Is called when a BYE packet has been processed for source \c srcdat. */
|
||||||
|
@ -531,12 +531,12 @@ protected:
|
||||||
* yourself, a good way may be to do this in RTPSession::OnSentRTPOrRTCPData. If `senddata` is
|
* yourself, a good way may be to do this in RTPSession::OnSentRTPOrRTCPData. If `senddata` is
|
||||||
* set to 0, no packet will be sent out. This also provides a way to turn off sending RTCP
|
* set to 0, no packet will be sent out. This also provides a way to turn off sending RTCP
|
||||||
* packets if desired. */
|
* packets if desired. */
|
||||||
virtual int OnChangeRTPOrRTCPData(const void *origdata, size_t origlen, bool isrtp, void **senddata, size_t *sendlen);
|
virtual int OnChangeRTPOrRTCPData(const void *origdata, std::size_t origlen, bool isrtp, void **senddata, std::size_t *sendlen);
|
||||||
|
|
||||||
/** This function is called when an RTP or RTCP packet was sent, it can be helpful
|
/** This function is called when an RTP or RTCP packet was sent, it can be helpful
|
||||||
* when data was allocated in RTPSession::OnChangeRTPOrRTCPData to deallocate it
|
* when data was allocated in RTPSession::OnChangeRTPOrRTCPData to deallocate it
|
||||||
* here. */
|
* here. */
|
||||||
virtual void OnSentRTPOrRTCPData(void *senddata, size_t sendlen, bool isrtp);
|
virtual void OnSentRTPOrRTCPData(void *senddata, std::size_t sendlen, bool isrtp);
|
||||||
|
|
||||||
/** By overriding this function, the raw incoming data can be inspected
|
/** By overriding this function, the raw incoming data can be inspected
|
||||||
* and modified (e.g. for encryption).
|
* and modified (e.g. for encryption).
|
||||||
|
@ -559,12 +559,12 @@ protected:
|
||||||
virtual void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled);
|
virtual void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled);
|
||||||
private:
|
private:
|
||||||
int InternalCreate(const RTPSessionParams &sessparams);
|
int InternalCreate(const RTPSessionParams &sessparams);
|
||||||
int CreateCNAME(uint8_t *buffer, size_t *bufferlength, bool resolve);
|
int CreateCNAME(uint8_t *buffer, std::size_t *bufferlength, bool resolve);
|
||||||
int ProcessPolledData();
|
int ProcessPolledData();
|
||||||
int ProcessRTCPCompoundPacket(RTCPCompoundPacket &rtcpcomppack, RTPRawPacket *pack);
|
int ProcessRTCPCompoundPacket(RTCPCompoundPacket &rtcpcomppack, RTPRawPacket *pack);
|
||||||
RTPRandom *GetRandomNumberGenerator(RTPRandom *r);
|
RTPRandom *GetRandomNumberGenerator(RTPRandom *r);
|
||||||
int SendRTPData(const void *data, size_t len);
|
int SendRTPData(const void *data, std::size_t len);
|
||||||
int SendRTCPData(const void *data, size_t len);
|
int SendRTCPData(const void *data, std::size_t len);
|
||||||
|
|
||||||
RTPRandom *rtprnd;
|
RTPRandom *rtprnd;
|
||||||
bool deletertprnd;
|
bool deletertprnd;
|
||||||
|
@ -575,7 +575,7 @@ private:
|
||||||
bool usingpollthread, needthreadsafety;
|
bool usingpollthread, needthreadsafety;
|
||||||
bool acceptownpackets;
|
bool acceptownpackets;
|
||||||
bool useSR_BYEifpossible;
|
bool useSR_BYEifpossible;
|
||||||
size_t maxpacksize;
|
std::size_t maxpacksize;
|
||||||
double sessionbandwidth;
|
double sessionbandwidth;
|
||||||
double controlfragment;
|
double controlfragment;
|
||||||
double sendermultiplier;
|
double sendermultiplier;
|
||||||
|
@ -612,7 +612,7 @@ inline void RTPSession::OnRTCPCompoundPacket(RTCPCompoundPacket *, const RTPTime
|
||||||
inline void RTPSession::OnSSRCCollision(RTPSourceData *, const RTPAddress *, bool)
|
inline void RTPSession::OnSSRCCollision(RTPSourceData *, const RTPAddress *, bool)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
inline void RTPSession::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, size_t)
|
inline void RTPSession::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, std::size_t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
inline void RTPSession::OnNewSource(RTPSourceData *)
|
inline void RTPSession::OnNewSource(RTPSourceData *)
|
||||||
|
@ -645,12 +645,12 @@ inline void RTPSession::OnRTCPSenderReport(RTPSourceData *)
|
||||||
inline void RTPSession::OnRTCPReceiverReport(RTPSourceData *)
|
inline void RTPSession::OnRTCPReceiverReport(RTPSourceData *)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
inline void RTPSession::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, size_t)
|
inline void RTPSession::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, std::size_t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
inline void RTPSession::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, size_t, const void *, size_t)
|
inline void RTPSession::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, std::size_t, const void *, std::size_t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif // RTP_SUPPORT_SDESPRIV
|
#endif // RTP_SUPPORT_SDESPRIV
|
||||||
|
@ -662,11 +662,11 @@ inline void RTPSession::OnSendRTCPCompoundPacket(RTCPCompoundPacket *)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int RTPSession::OnChangeRTPOrRTCPData(const void *, size_t, bool, void **, size_t *)
|
inline int RTPSession::OnChangeRTPOrRTCPData(const void *, std::size_t, bool, void **, std::size_t *)
|
||||||
{
|
{
|
||||||
return ERR_RTP_RTPSESSION_CHANGEREQUESTEDBUTNOTIMPLEMENTED;
|
return ERR_RTP_RTPSESSION_CHANGEREQUESTEDBUTNOTIMPLEMENTED;
|
||||||
}
|
}
|
||||||
inline void RTPSession::OnSentRTPOrRTCPData(void *, size_t, bool)
|
inline void RTPSession::OnSentRTPOrRTCPData(void *, std::size_t, bool)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
inline bool RTPSession::OnChangeIncomingData(RTPRawPacket *)
|
inline bool RTPSession::OnChangeIncomingData(RTPRawPacket *)
|
||||||
|
|
|
@ -72,13 +72,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the maximum allowed packet size for the session. */
|
/** Sets the maximum allowed packet size for the session. */
|
||||||
void SetMaximumPacketSize(size_t max)
|
void SetMaximumPacketSize(std::size_t max)
|
||||||
{
|
{
|
||||||
maxpacksize = max;
|
maxpacksize = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the maximum allowed packet size (default is 1400 bytes). */
|
/** Returns the maximum allowed packet size (default is 1400 bytes). */
|
||||||
size_t GetMaximumPacketSize() const
|
std::size_t GetMaximumPacketSize() const
|
||||||
{
|
{
|
||||||
return maxpacksize;
|
return maxpacksize;
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ public:
|
||||||
private:
|
private:
|
||||||
bool acceptown;
|
bool acceptown;
|
||||||
bool usepollthread;
|
bool usepollthread;
|
||||||
size_t maxpacksize;
|
std::size_t maxpacksize;
|
||||||
double owntsunit;
|
double owntsunit;
|
||||||
RTPTransmitter::ReceiveMode receivemode;
|
RTPTransmitter::ReceiveMode receivemode;
|
||||||
bool resolvehostname;
|
bool resolvehostname;
|
||||||
|
|
|
@ -56,7 +56,7 @@ void RTPSessionSources::OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress
|
||||||
rtpsession.OnSSRCCollision(srcdat, senderaddress, isrtp);
|
rtpsession.OnSSRCCollision(srcdat, senderaddress, isrtp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPSessionSources::OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, size_t cnamelength)
|
void RTPSessionSources::OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, std::size_t cnamelength)
|
||||||
{
|
{
|
||||||
rtpsession.OnCNAMECollision(srcdat, senderaddress, cname, cnamelength);
|
rtpsession.OnCNAMECollision(srcdat, senderaddress, cname, cnamelength);
|
||||||
}
|
}
|
||||||
|
@ -123,13 +123,13 @@ void RTPSessionSources::OnRTCPReceiverReport(RTPSourceData *srcdat)
|
||||||
rtpsession.OnRTCPReceiverReport(srcdat);
|
rtpsession.OnRTCPReceiverReport(srcdat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTPSessionSources::OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, size_t itemlength)
|
void RTPSessionSources::OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, std::size_t itemlength)
|
||||||
{
|
{
|
||||||
rtpsession.OnRTCPSDESItem(srcdat, t, itemdata, itemlength);
|
rtpsession.OnRTCPSDESItem(srcdat, t, itemdata, itemlength);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
void RTPSessionSources::OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, const void *valuedata, size_t valuelen)
|
void RTPSessionSources::OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, std::size_t prefixlen, const void *valuedata, std::size_t valuelen)
|
||||||
{
|
{
|
||||||
rtpsession.OnRTCPSDESPrivateItem(srcdat, prefixdata, prefixlen, valuedata, valuelen);
|
rtpsession.OnRTCPSDESPrivateItem(srcdat, prefixdata, prefixlen, valuedata, valuelen);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ private:
|
||||||
void OnRTPPacket(RTPPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress);
|
void OnRTPPacket(RTPPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress);
|
||||||
void OnRTCPCompoundPacket(RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress);
|
void OnRTCPCompoundPacket(RTCPCompoundPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress);
|
||||||
void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp);
|
void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp);
|
||||||
void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, size_t cnamelength);
|
void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, std::size_t cnamelength);
|
||||||
void OnNewSource(RTPSourceData *srcdat);
|
void OnNewSource(RTPSourceData *srcdat);
|
||||||
void OnRemoveSource(RTPSourceData *srcdat);
|
void OnRemoveSource(RTPSourceData *srcdat);
|
||||||
void OnTimeout(RTPSourceData *srcdat);
|
void OnTimeout(RTPSourceData *srcdat);
|
||||||
|
@ -82,9 +82,9 @@ private:
|
||||||
void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled);
|
void OnValidatedRTPPacket(RTPSourceData *srcdat, RTPPacket *rtppack, bool isonprobation, bool *ispackethandled);
|
||||||
void OnRTCPSenderReport(RTPSourceData *srcdat);
|
void OnRTCPSenderReport(RTPSourceData *srcdat);
|
||||||
void OnRTCPReceiverReport(RTPSourceData *srcdat);
|
void OnRTCPReceiverReport(RTPSourceData *srcdat);
|
||||||
void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, size_t itemlength);
|
void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, std::size_t itemlength);
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, const void *valuedata, size_t valuelen);
|
void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, std::size_t prefixlen, const void *valuedata, std::size_t valuelen);
|
||||||
#endif // RTP_SUPPORT_SDESPRIV
|
#endif // RTP_SUPPORT_SDESPRIV
|
||||||
|
|
||||||
RTPSession &rtpsession;
|
RTPSession &rtpsession;
|
||||||
|
|
|
@ -405,7 +405,7 @@ public:
|
||||||
* Returns the reason for leaving contained in the BYE packet of this participant. The length of
|
* Returns the reason for leaving contained in the BYE packet of this participant. The length of
|
||||||
* the reason is stored in \c len.
|
* the reason is stored in \c len.
|
||||||
*/
|
*/
|
||||||
uint8_t *GetBYEReason(size_t *len) const
|
uint8_t *GetBYEReason(std::size_t *len) const
|
||||||
{
|
{
|
||||||
*len = byereasonlen;
|
*len = byereasonlen;
|
||||||
return byereason;
|
return byereason;
|
||||||
|
@ -679,43 +679,43 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a pointer to the SDES CNAME item of this participant and stores its length in \c len. */
|
/** Returns a pointer to the SDES CNAME item of this participant and stores its length in \c len. */
|
||||||
uint8_t *SDES_GetCNAME(size_t *len) const
|
uint8_t *SDES_GetCNAME(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return SDESinf.GetCNAME(len);
|
return SDESinf.GetCNAME(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a pointer to the SDES name item of this participant and stores its length in \c len. */
|
/** Returns a pointer to the SDES name item of this participant and stores its length in \c len. */
|
||||||
uint8_t *SDES_GetName(size_t *len) const
|
uint8_t *SDES_GetName(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return SDESinf.GetName(len);
|
return SDESinf.GetName(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a pointer to the SDES e-mail item of this participant and stores its length in \c len. */
|
/** Returns a pointer to the SDES e-mail item of this participant and stores its length in \c len. */
|
||||||
uint8_t *SDES_GetEMail(size_t *len) const
|
uint8_t *SDES_GetEMail(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return SDESinf.GetEMail(len);
|
return SDESinf.GetEMail(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a pointer to the SDES phone item of this participant and stores its length in \c len. */
|
/** Returns a pointer to the SDES phone item of this participant and stores its length in \c len. */
|
||||||
uint8_t *SDES_GetPhone(size_t *len) const
|
uint8_t *SDES_GetPhone(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return SDESinf.GetPhone(len);
|
return SDESinf.GetPhone(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a pointer to the SDES location item of this participant and stores its length in \c len. */
|
/** Returns a pointer to the SDES location item of this participant and stores its length in \c len. */
|
||||||
uint8_t *SDES_GetLocation(size_t *len) const
|
uint8_t *SDES_GetLocation(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return SDESinf.GetLocation(len);
|
return SDESinf.GetLocation(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a pointer to the SDES tool item of this participant and stores its length in \c len. */
|
/** Returns a pointer to the SDES tool item of this participant and stores its length in \c len. */
|
||||||
uint8_t *SDES_GetTool(size_t *len) const
|
uint8_t *SDES_GetTool(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return SDESinf.GetTool(len);
|
return SDESinf.GetTool(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a pointer to the SDES note item of this participant and stores its length in \c len. */
|
/** Returns a pointer to the SDES note item of this participant and stores its length in \c len. */
|
||||||
uint8_t *SDES_GetNote(size_t *len) const
|
uint8_t *SDES_GetNote(std::size_t *len) const
|
||||||
{
|
{
|
||||||
return SDESinf.GetNote(len);
|
return SDESinf.GetNote(len);
|
||||||
}
|
}
|
||||||
|
@ -730,7 +730,7 @@ public:
|
||||||
/** If available, returns \c true and stores the next SDES private item prefix in \c prefix and its length in
|
/** If available, returns \c true and stores the next SDES private item prefix in \c prefix and its length in
|
||||||
* \c prefixlen; the associated value and its length are then stored in \c value and \c valuelen.
|
* \c prefixlen; the associated value and its length are then stored in \c value and \c valuelen.
|
||||||
*/
|
*/
|
||||||
bool SDES_GetNextPrivateValue(uint8_t **prefix, size_t *prefixlen, uint8_t **value, size_t *valuelen)
|
bool SDES_GetNextPrivateValue(uint8_t **prefix, std::size_t *prefixlen, uint8_t **value, std::size_t *valuelen)
|
||||||
{
|
{
|
||||||
return SDESinf.GetNextPrivateValue(prefix, prefixlen, value, valuelen);
|
return SDESinf.GetNextPrivateValue(prefix, prefixlen, value, valuelen);
|
||||||
}
|
}
|
||||||
|
@ -739,7 +739,7 @@ public:
|
||||||
* \c prefixlen; if found, the function returns \c true and stores the associated value and
|
* \c prefixlen; if found, the function returns \c true and stores the associated value and
|
||||||
* its length in \c value and \c valuelen respectively.
|
* its length in \c value and \c valuelen respectively.
|
||||||
*/
|
*/
|
||||||
bool SDES_GetPrivateValue(uint8_t *prefix, size_t prefixlen, uint8_t **value, size_t *valuelen) const
|
bool SDES_GetPrivateValue(uint8_t *prefix, std::size_t prefixlen, uint8_t **value, std::size_t *valuelen) const
|
||||||
{
|
{
|
||||||
return SDESinf.GetPrivateValue(prefix, prefixlen, value, valuelen);
|
return SDESinf.GetPrivateValue(prefix, prefixlen, value, valuelen);
|
||||||
}
|
}
|
||||||
|
@ -767,7 +767,7 @@ protected:
|
||||||
|
|
||||||
RTPTime byetime;
|
RTPTime byetime;
|
||||||
uint8_t *byereason;
|
uint8_t *byereason;
|
||||||
size_t byereasonlen;
|
std::size_t byereasonlen;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline RTPPacket *RTPSourceData::GetNextPacket()
|
inline RTPPacket *RTPSourceData::GetNextPacket()
|
||||||
|
|
|
@ -686,7 +686,7 @@ int RTPSources::ProcessRTCPReportBlock(uint32_t ssrc, uint8_t fractionlost, int3
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPSources::ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t, size_t itemlength, const void *itemdata, const RTPTime &receivetime,
|
int RTPSources::ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t, std::size_t itemlength, const void *itemdata, const RTPTime &receivetime,
|
||||||
const RTPAddress *senderaddress)
|
const RTPAddress *senderaddress)
|
||||||
{
|
{
|
||||||
RTPInternalSourceData *srcdat;
|
RTPInternalSourceData *srcdat;
|
||||||
|
@ -746,7 +746,7 @@ int RTPSources::ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
int RTPSources::ProcessSDESPrivateItem(uint32_t ssrc, size_t prefixlen, const void *prefixdata, size_t valuelen, const void *valuedata, const RTPTime &receivetime,
|
int RTPSources::ProcessSDESPrivateItem(uint32_t ssrc, std::size_t prefixlen, const void *prefixdata, std::size_t valuelen, const void *valuedata, const RTPTime &receivetime,
|
||||||
const RTPAddress *senderaddress)
|
const RTPAddress *senderaddress)
|
||||||
{
|
{
|
||||||
RTPInternalSourceData *srcdat;
|
RTPInternalSourceData *srcdat;
|
||||||
|
@ -771,7 +771,7 @@ int RTPSources::ProcessSDESPrivateItem(uint32_t ssrc, size_t prefixlen, const vo
|
||||||
}
|
}
|
||||||
#endif //RTP_SUPPORT_SDESPRIV
|
#endif //RTP_SUPPORT_SDESPRIV
|
||||||
|
|
||||||
int RTPSources::ProcessBYE(uint32_t ssrc, size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress)
|
int RTPSources::ProcessBYE(uint32_t ssrc, std::size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress)
|
||||||
{
|
{
|
||||||
RTPInternalSourceData *srcdat;
|
RTPInternalSourceData *srcdat;
|
||||||
bool created;
|
bool created;
|
||||||
|
@ -1027,7 +1027,7 @@ void RTPSources::NoteTimeout(const RTPTime &curtime, const RTPTime &timeoutdelay
|
||||||
while (sourcelist.HasCurrentElement())
|
while (sourcelist.HasCurrentElement())
|
||||||
{
|
{
|
||||||
RTPInternalSourceData *srcdat = sourcelist.GetCurrentElement();
|
RTPInternalSourceData *srcdat = sourcelist.GetCurrentElement();
|
||||||
size_t notelen;
|
std::size_t notelen;
|
||||||
|
|
||||||
srcdat->SDES_GetNote(¬elen);
|
srcdat->SDES_GetNote(¬elen);
|
||||||
if (notelen != 0) // Note has been set
|
if (notelen != 0) // Note has been set
|
||||||
|
@ -1076,7 +1076,7 @@ void RTPSources::MultipleTimeouts(const RTPTime &curtime, const RTPTime &sendert
|
||||||
bool deleted, issender, isactive;
|
bool deleted, issender, isactive;
|
||||||
bool byetimeout, normaltimeout, notetimeout;
|
bool byetimeout, normaltimeout, notetimeout;
|
||||||
|
|
||||||
size_t notelen;
|
std::size_t notelen;
|
||||||
|
|
||||||
issender = srcdat->IsSender();
|
issender = srcdat->IsSender();
|
||||||
isactive = srcdat->IsActive();
|
isactive = srcdat->IsActive();
|
||||||
|
|
|
@ -153,14 +153,14 @@ public:
|
||||||
* received at time \c receivetime from address \c senderaddress. The \c senderaddress parameter must
|
* received at time \c receivetime from address \c senderaddress. The \c senderaddress parameter must
|
||||||
* be NULL if the packet was sent by the local participant.
|
* be NULL if the packet was sent by the local participant.
|
||||||
*/
|
*/
|
||||||
int ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t, size_t itemlength, const void *itemdata, const RTPTime &receivetime, const RTPAddress *senderaddress);
|
int ProcessSDESNormalItem(uint32_t ssrc, RTCPSDESPacket::ItemType t, std::size_t itemlength, const void *itemdata, const RTPTime &receivetime, const RTPAddress *senderaddress);
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
/** Processes the SDES private item from source \c ssrc into the source table.
|
/** Processes the SDES private item from source \c ssrc into the source table.
|
||||||
* Processes the SDES private item from source \c ssrc into the source table. The information was
|
* Processes the SDES private item from source \c ssrc into the source table. The information was
|
||||||
* received at time \c receivetime from address \c senderaddress. The \c senderaddress
|
* received at time \c receivetime from address \c senderaddress. The \c senderaddress
|
||||||
* parameter must be NULL if the packet was sent by the local participant.
|
* parameter must be NULL if the packet was sent by the local participant.
|
||||||
*/
|
*/
|
||||||
int ProcessSDESPrivateItem(uint32_t ssrc, size_t prefixlen, const void *prefixdata, size_t valuelen, const void *valuedata, const RTPTime &receivetime,
|
int ProcessSDESPrivateItem(uint32_t ssrc, std::size_t prefixlen, const void *prefixdata, std::size_t valuelen, const void *valuedata, const RTPTime &receivetime,
|
||||||
const RTPAddress *senderaddress);
|
const RTPAddress *senderaddress);
|
||||||
#endif //RTP_SUPPORT_SDESPRIV
|
#endif //RTP_SUPPORT_SDESPRIV
|
||||||
/** Processes the BYE message for SSRC \c ssrc.
|
/** Processes the BYE message for SSRC \c ssrc.
|
||||||
|
@ -168,7 +168,7 @@ public:
|
||||||
* address \c senderaddress. The \c senderaddress parameter must be NULL if the packet was sent by the
|
* address \c senderaddress. The \c senderaddress parameter must be NULL if the packet was sent by the
|
||||||
* local participant.
|
* local participant.
|
||||||
*/
|
*/
|
||||||
int ProcessBYE(uint32_t ssrc, size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress);
|
int ProcessBYE(uint32_t ssrc, std::size_t reasonlength, const void *reasondata, const RTPTime &receivetime, const RTPAddress *senderaddress);
|
||||||
|
|
||||||
/** If we heard from source \c ssrc, but no actual data was added to the source table (for example, if
|
/** If we heard from source \c ssrc, but no actual data was added to the source table (for example, if
|
||||||
* no report block was meant for us), this function can e used to indicate that something was received from
|
* no report block was meant for us), this function can e used to indicate that something was received from
|
||||||
|
@ -302,7 +302,7 @@ protected:
|
||||||
virtual void OnSSRCCollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, bool isrtp);
|
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. */
|
/** 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);
|
virtual void OnCNAMECollision(RTPSourceData *srcdat, const RTPAddress *senderaddress, const uint8_t *cname, std::size_t cnamelength);
|
||||||
|
|
||||||
/** Is called when a new entry \c srcdat is added to the source table. */
|
/** Is called when a new entry \c srcdat is added to the source table. */
|
||||||
virtual void OnNewSource(RTPSourceData *srcdat);
|
virtual void OnNewSource(RTPSourceData *srcdat);
|
||||||
|
@ -326,10 +326,10 @@ protected:
|
||||||
virtual void OnRTCPReceiverReport(RTPSourceData *srcdat);
|
virtual void OnRTCPReceiverReport(RTPSourceData *srcdat);
|
||||||
|
|
||||||
/** Is called when a specific SDES item was received for this source. */
|
/** Is called when a specific SDES item was received for this source. */
|
||||||
virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, size_t itemlength);
|
virtual void OnRTCPSDESItem(RTPSourceData *srcdat, RTCPSDESPacket::ItemType t, const void *itemdata, std::size_t itemlength);
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
/** Is called when a specific SDES item of 'private' type was received for this source. */
|
/** Is called when a specific SDES item of 'private' type was received for this source. */
|
||||||
virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, size_t prefixlen, const void *valuedata, size_t valuelen);
|
virtual void OnRTCPSDESPrivateItem(RTPSourceData *srcdat, const void *prefixdata, std::size_t prefixlen, const void *valuedata, std::size_t valuelen);
|
||||||
#endif // RTP_SUPPORT_SDESPRIV
|
#endif // RTP_SUPPORT_SDESPRIV
|
||||||
|
|
||||||
/** Is called when an RTCP APP packet \c apppacket has been received at time \c receivetime
|
/** Is called when an RTCP APP packet \c apppacket has been received at time \c receivetime
|
||||||
|
@ -378,7 +378,7 @@ inline void RTPSources::OnRTCPCompoundPacket(RTCPCompoundPacket *, const RTPTime
|
||||||
inline void RTPSources::OnSSRCCollision(RTPSourceData *, const RTPAddress *, bool)
|
inline void RTPSources::OnSSRCCollision(RTPSourceData *, const RTPAddress *, bool)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
inline void RTPSources::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, size_t)
|
inline void RTPSources::OnCNAMECollision(RTPSourceData *, const RTPAddress *, const uint8_t *, std::size_t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
inline void RTPSources::OnNewSource(RTPSourceData *)
|
inline void RTPSources::OnNewSource(RTPSourceData *)
|
||||||
|
@ -402,11 +402,11 @@ inline void RTPSources::OnRTCPSenderReport(RTPSourceData *)
|
||||||
inline void RTPSources::OnRTCPReceiverReport(RTPSourceData *)
|
inline void RTPSources::OnRTCPReceiverReport(RTPSourceData *)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
inline void RTPSources::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, size_t)
|
inline void RTPSources::OnRTCPSDESItem(RTPSourceData *, RTCPSDESPacket::ItemType, const void *, std::size_t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#ifdef RTP_SUPPORT_SDESPRIV
|
#ifdef RTP_SUPPORT_SDESPRIV
|
||||||
inline void RTPSources::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, size_t, const void *, size_t)
|
inline void RTPSources::OnRTCPSDESPrivateItem(RTPSourceData *, const void *, std::size_t, const void *, std::size_t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif // RTP_SUPPORT_SDESPRIV
|
#endif // RTP_SUPPORT_SDESPRIV
|
||||||
|
|
|
@ -76,7 +76,7 @@ int RTPTCPTransmitter::Init(bool tsafe)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPTCPTransmitter::Create(size_t maximumpacketsize __attribute__((unused)), const RTPTransmissionParams *transparams)
|
int RTPTCPTransmitter::Create(std::size_t maximumpacketsize __attribute__((unused)), const RTPTransmissionParams *transparams)
|
||||||
{
|
{
|
||||||
const RTPTCPTransmissionParams *params, defaultparams;
|
const RTPTCPTransmissionParams *params, defaultparams;
|
||||||
int status;
|
int status;
|
||||||
|
@ -167,7 +167,7 @@ void RTPTCPTransmitter::DeleteTransmissionInfo(RTPTransmissionInfo *i)
|
||||||
delete i;
|
delete i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPTCPTransmitter::GetLocalHostName(uint8_t *buffer, size_t *bufferlength)
|
int RTPTCPTransmitter::GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength)
|
||||||
{
|
{
|
||||||
if (!m_init)
|
if (!m_init)
|
||||||
return ERR_RTP_TCPTRANS_NOTINIT;
|
return ERR_RTP_TCPTRANS_NOTINIT;
|
||||||
|
@ -259,7 +259,7 @@ int RTPTCPTransmitter::Poll()
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < errSockets.size(); i++)
|
for (std::size_t i = 0; i < errSockets.size(); i++)
|
||||||
OnReceiveError(errSockets[i]);
|
OnReceiveError(errSockets[i]);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -324,7 +324,7 @@ int RTPTCPTransmitter::WaitForIncomingData(const RTPTime &delay, bool *dataavail
|
||||||
{
|
{
|
||||||
bool avail = false;
|
bool avail = false;
|
||||||
|
|
||||||
for (size_t i = 0; i < m_tmpFlags.size(); i++)
|
for (std::size_t i = 0; i < m_tmpFlags.size(); i++)
|
||||||
{
|
{
|
||||||
if (m_tmpFlags[i])
|
if (m_tmpFlags[i])
|
||||||
{
|
{
|
||||||
|
@ -362,12 +362,12 @@ int RTPTCPTransmitter::AbortWait()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPTCPTransmitter::SendRTPData(const void *data, size_t len)
|
int RTPTCPTransmitter::SendRTPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
return SendRTPRTCPData(data, len);
|
return SendRTPRTCPData(data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPTCPTransmitter::SendRTCPData(const void *data, size_t len)
|
int RTPTCPTransmitter::SendRTCPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
return SendRTPRTCPData(data, len);
|
return SendRTPRTCPData(data, len);
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,7 @@ void RTPTCPTransmitter::ClearAcceptList()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPTCPTransmitter::SetMaximumPacketSize(size_t s)
|
int RTPTCPTransmitter::SetMaximumPacketSize(std::size_t s)
|
||||||
{
|
{
|
||||||
if (!m_init)
|
if (!m_init)
|
||||||
return ERR_RTP_TCPTRANS_NOTINIT;
|
return ERR_RTP_TCPTRANS_NOTINIT;
|
||||||
|
@ -603,7 +603,7 @@ int RTPTCPTransmitter::PollSocket(SocketType sock, SocketData &sdata)
|
||||||
#ifdef RTP_SOCKETTYPE_WINSOCK
|
#ifdef RTP_SOCKETTYPE_WINSOCK
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
#else
|
#else
|
||||||
size_t len;
|
std::size_t len;
|
||||||
#endif // RTP_SOCKETTYPE_WINSOCK
|
#endif // RTP_SOCKETTYPE_WINSOCK
|
||||||
bool dataavailable;
|
bool dataavailable;
|
||||||
|
|
||||||
|
@ -668,7 +668,7 @@ int RTPTCPTransmitter::PollSocket(SocketType sock, SocketData &sdata)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPTCPTransmitter::SendRTPRTCPData(const void *data, size_t len)
|
int RTPTCPTransmitter::SendRTPRTCPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!m_init)
|
if (!m_init)
|
||||||
return ERR_RTP_TCPTRANS_NOTINIT;
|
return ERR_RTP_TCPTRANS_NOTINIT;
|
||||||
|
@ -706,7 +706,7 @@ int RTPTCPTransmitter::SendRTPRTCPData(const void *data, size_t len)
|
||||||
|
|
||||||
if (errSockets.size() != 0)
|
if (errSockets.size() != 0)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < errSockets.size(); i++)
|
for (std::size_t i = 0; i < errSockets.size(); i++)
|
||||||
OnSendError(errSockets[i]);
|
OnSendError(errSockets[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,14 +124,14 @@ public:
|
||||||
~RTPTCPTransmitter();
|
~RTPTCPTransmitter();
|
||||||
|
|
||||||
int Init(bool treadsafe);
|
int Init(bool treadsafe);
|
||||||
int Create(size_t maxpacksize, const RTPTransmissionParams *transparams);
|
int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams);
|
||||||
void Destroy();
|
void Destroy();
|
||||||
RTPTransmissionInfo *GetTransmissionInfo();
|
RTPTransmissionInfo *GetTransmissionInfo();
|
||||||
void DeleteTransmissionInfo(RTPTransmissionInfo *inf);
|
void DeleteTransmissionInfo(RTPTransmissionInfo *inf);
|
||||||
|
|
||||||
int GetLocalHostName(uint8_t *buffer, size_t *bufferlength);
|
int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength);
|
||||||
bool ComesFromThisTransmitter(const RTPAddress *addr);
|
bool ComesFromThisTransmitter(const RTPAddress *addr);
|
||||||
size_t GetHeaderOverhead()
|
std::size_t GetHeaderOverhead()
|
||||||
{
|
{
|
||||||
return RTPTCPTRANS_HEADERSIZE;
|
return RTPTCPTRANS_HEADERSIZE;
|
||||||
}
|
}
|
||||||
|
@ -140,8 +140,8 @@ public:
|
||||||
int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0);
|
int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0);
|
||||||
int AbortWait();
|
int AbortWait();
|
||||||
|
|
||||||
int SendRTPData(const void *data, size_t len);
|
int SendRTPData(const void *data, std::size_t len);
|
||||||
int SendRTCPData(const void *data, size_t len);
|
int SendRTCPData(const void *data, std::size_t len);
|
||||||
|
|
||||||
int AddDestination(const RTPAddress &addr);
|
int AddDestination(const RTPAddress &addr);
|
||||||
int DeleteDestination(const RTPAddress &addr);
|
int DeleteDestination(const RTPAddress &addr);
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
int AddToAcceptList(const RTPAddress &addr);
|
int AddToAcceptList(const RTPAddress &addr);
|
||||||
int DeleteFromAcceptList(const RTPAddress &addr);
|
int DeleteFromAcceptList(const RTPAddress &addr);
|
||||||
void ClearAcceptList();
|
void ClearAcceptList();
|
||||||
int SetMaximumPacketSize(size_t s);
|
int SetMaximumPacketSize(std::size_t s);
|
||||||
|
|
||||||
bool NewDataAvailable();
|
bool NewDataAvailable();
|
||||||
RTPRawPacket *GetNextPacket();
|
RTPRawPacket *GetNextPacket();
|
||||||
|
@ -191,7 +191,7 @@ private:
|
||||||
int ProcessAvailableBytes(SocketType sock, int availLen, bool &complete);
|
int ProcessAvailableBytes(SocketType sock, int availLen, bool &complete);
|
||||||
};
|
};
|
||||||
|
|
||||||
int SendRTPRTCPData(const void *data, size_t len);
|
int SendRTPRTCPData(const void *data, std::size_t len);
|
||||||
void FlushPackets();
|
void FlushPackets();
|
||||||
int PollSocket(SocketType sock, SocketData &sdata);
|
int PollSocket(SocketType sock, SocketData &sdata);
|
||||||
void ClearDestSockets();
|
void ClearDestSockets();
|
||||||
|
@ -205,7 +205,7 @@ private:
|
||||||
std::vector<SocketType> m_tmpSocks;
|
std::vector<SocketType> m_tmpSocks;
|
||||||
std::vector<int8_t> m_tmpFlags;
|
std::vector<int8_t> m_tmpFlags;
|
||||||
std::vector<uint8_t> m_localHostname;
|
std::vector<uint8_t> m_localHostname;
|
||||||
size_t m_maxPackSize;
|
std::size_t m_maxPackSize;
|
||||||
|
|
||||||
std::list<RTPRawPacket*> m_rawpacketlist;
|
std::list<RTPRawPacket*> m_rawpacketlist;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "rtpconfig.h"
|
#include "rtpconfig.h"
|
||||||
#include "rtptypes.h"
|
#include "rtptypes.h"
|
||||||
#include "rtptimeutilities.h"
|
#include "rtptimeutilities.h"
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace qrtplib
|
namespace qrtplib
|
||||||
{
|
{
|
||||||
|
@ -107,7 +108,7 @@ public:
|
||||||
* from RTPTransmissionParams. If \c transparams is NULL, the default transmission parameters
|
* from RTPTransmissionParams. If \c transparams is NULL, the default transmission parameters
|
||||||
* for the component will be used.
|
* for the component will be used.
|
||||||
*/
|
*/
|
||||||
virtual int Create(size_t maxpacksize, const RTPTransmissionParams *transparams) = 0;
|
virtual int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams) = 0;
|
||||||
|
|
||||||
/** By calling this function, buffers are cleared and the component cannot be used anymore.
|
/** By calling this function, buffers are cleared and the component cannot be used anymore.
|
||||||
* By calling this function, buffers are cleared and the component cannot be used anymore.
|
* By calling this function, buffers are cleared and the component cannot be used anymore.
|
||||||
|
@ -137,14 +138,14 @@ public:
|
||||||
* it returns \c ERR_RTP_TRANS_BUFFERLENGTHTOOSMALL and stores the number of bytes needed in
|
* it returns \c ERR_RTP_TRANS_BUFFERLENGTHTOOSMALL and stores the number of bytes needed in
|
||||||
* \c bufferlength.
|
* \c bufferlength.
|
||||||
*/
|
*/
|
||||||
virtual int GetLocalHostName(uint8_t *buffer, size_t *bufferlength) = 0;
|
virtual int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength) = 0;
|
||||||
|
|
||||||
/** Returns \c true if the address specified by \c addr is one of the addresses of the transmitter. */
|
/** Returns \c true if the address specified by \c addr is one of the addresses of the transmitter. */
|
||||||
virtual bool ComesFromThisTransmitter(const RTPAddress *addr) = 0;
|
virtual bool ComesFromThisTransmitter(const RTPAddress *addr) = 0;
|
||||||
|
|
||||||
/** Returns the amount of bytes that will be added to the RTP packet by the underlying layers (excluding
|
/** Returns the amount of bytes that will be added to the RTP packet by the underlying layers (excluding
|
||||||
* the link layer). */
|
* the link layer). */
|
||||||
virtual size_t GetHeaderOverhead() = 0;
|
virtual std::size_t GetHeaderOverhead() = 0;
|
||||||
|
|
||||||
/** Checks for incoming data and stores it. */
|
/** Checks for incoming data and stores it. */
|
||||||
virtual int Poll() = 0;
|
virtual int Poll() = 0;
|
||||||
|
@ -159,10 +160,10 @@ public:
|
||||||
virtual int AbortWait() = 0;
|
virtual int AbortWait() = 0;
|
||||||
|
|
||||||
/** Send a packet with length \c len containing \c data to all RTP addresses of the current destination list. */
|
/** Send a packet with length \c len containing \c data to all RTP addresses of the current destination list. */
|
||||||
virtual int SendRTPData(const void *data, size_t len) = 0;
|
virtual int SendRTPData(const void *data, std::size_t len) = 0;
|
||||||
|
|
||||||
/** Send a packet with length \c len containing \c data to all RTCP addresses of the current destination list. */
|
/** Send a packet with length \c len containing \c data to all RTCP addresses of the current destination list. */
|
||||||
virtual int SendRTCPData(const void *data, size_t len) = 0;
|
virtual int SendRTCPData(const void *data, std::size_t len) = 0;
|
||||||
|
|
||||||
/** Adds the address specified by \c addr to the list of destinations. */
|
/** Adds the address specified by \c addr to the list of destinations. */
|
||||||
virtual int AddDestination(const RTPAddress &addr) = 0;
|
virtual int AddDestination(const RTPAddress &addr) = 0;
|
||||||
|
@ -211,7 +212,7 @@ public:
|
||||||
virtual void ClearAcceptList() = 0;
|
virtual void ClearAcceptList() = 0;
|
||||||
|
|
||||||
/** Sets the maximum packet size which the transmitter should allow to \c s. */
|
/** Sets the maximum packet size which the transmitter should allow to \c s. */
|
||||||
virtual int SetMaximumPacketSize(size_t s) = 0;
|
virtual int SetMaximumPacketSize(std::size_t s) = 0;
|
||||||
|
|
||||||
/** Returns \c true if packets can be obtained using the GetNextPacket member function. */
|
/** Returns \c true if packets can be obtained using the GetNextPacket member function. */
|
||||||
virtual bool NewDataAvailable() = 0;
|
virtual bool NewDataAvailable() = 0;
|
||||||
|
|
|
@ -137,7 +137,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc
|
||||||
SocketType sock = socket(PF_INET, SOCK_DGRAM, 0);
|
SocketType sock = socket(PF_INET, SOCK_DGRAM, 0);
|
||||||
if (sock == RTPSOCKERR)
|
if (sock == RTPSOCKERR)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET;
|
return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc
|
||||||
if (bind(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) != 0)
|
if (bind(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) != 0)
|
||||||
{
|
{
|
||||||
RTPCLOSE(sock);
|
RTPCLOSE(sock);
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
return ERR_RTP_UDPV4TRANS_CANTGETVALIDSOCKET;
|
return ERR_RTP_UDPV4TRANS_CANTGETVALIDSOCKET;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
{
|
{
|
||||||
RTPCLOSE(sock);
|
RTPCLOSE(sock);
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc
|
||||||
*pRtcpSock = sock;
|
*pRtcpSock = sock;
|
||||||
*pRtpPort = basePort;
|
*pRtpPort = basePort;
|
||||||
*pRtcpPort = basePort;
|
*pRtcpPort = basePort;
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -190,7 +190,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc
|
||||||
if (sock2 == RTPSOCKERR)
|
if (sock2 == RTPSOCKERR)
|
||||||
{
|
{
|
||||||
RTPCLOSE(sock);
|
RTPCLOSE(sock);
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET;
|
return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc
|
||||||
*pRtcpPort = basePort;
|
*pRtcpPort = basePort;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -249,13 +249,13 @@ int RTPUDPv4Transmitter::GetAutoSockets(uint32_t bindIP, bool allowOdd, bool rtc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
|
|
||||||
return ERR_RTP_UDPV4TRANS_TOOMANYATTEMPTSCHOOSINGSOCKET;
|
return ERR_RTP_UDPV4TRANS_TOOMANYATTEMPTSCHOOSINGSOCKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4Transmitter::Create(size_t maximumpacketsize, const RTPTransmissionParams *transparams)
|
int RTPUDPv4Transmitter::Create(std::size_t maximumpacketsize, const RTPTransmissionParams *transparams)
|
||||||
{
|
{
|
||||||
const RTPUDPv4TransmissionParams *params, defaultparams;
|
const RTPUDPv4TransmissionParams *params, defaultparams;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
|
@ -555,7 +555,7 @@ void RTPUDPv4Transmitter::DeleteTransmissionInfo(RTPTransmissionInfo *i)
|
||||||
delete i;
|
delete i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4Transmitter::GetLocalHostName(uint8_t *buffer, size_t *bufferlength)
|
int RTPUDPv4Transmitter::GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
|
@ -831,7 +831,7 @@ int RTPUDPv4Transmitter::AbortWait()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4Transmitter::SendRTPData(const void *data, size_t len)
|
int RTPUDPv4Transmitter::SendRTPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
|
@ -857,7 +857,7 @@ int RTPUDPv4Transmitter::SendRTPData(const void *data, size_t len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4Transmitter::SendRTCPData(const void *data, size_t len)
|
int RTPUDPv4Transmitter::SendRTCPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
|
@ -1248,7 +1248,7 @@ void RTPUDPv4Transmitter::ClearAcceptList()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4Transmitter::SetMaximumPacketSize(size_t s)
|
int RTPUDPv4Transmitter::SetMaximumPacketSize(std::size_t s)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
|
@ -1352,7 +1352,7 @@ int RTPUDPv4Transmitter::PollSocket(bool rtp)
|
||||||
SOCKET sock;
|
SOCKET sock;
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
#else
|
#else
|
||||||
size_t len;
|
std::size_t len;
|
||||||
int sock;
|
int sock;
|
||||||
#endif // RTP_SOCKETTYPE_WINSOCK
|
#endif // RTP_SOCKETTYPE_WINSOCK
|
||||||
struct sockaddr_in srcaddr;
|
struct sockaddr_in srcaddr;
|
||||||
|
@ -1425,7 +1425,7 @@ int RTPUDPv4Transmitter::PollSocket(bool rtp)
|
||||||
{
|
{
|
||||||
isrtp = true;
|
isrtp = true;
|
||||||
|
|
||||||
if ((size_t) recvlen > sizeof(RTCPCommonHeader))
|
if ((std::size_t) recvlen > sizeof(RTCPCommonHeader))
|
||||||
{
|
{
|
||||||
RTCPCommonHeader *rtcpheader = (RTCPCommonHeader *) datacopy;
|
RTCPCommonHeader *rtcpheader = (RTCPCommonHeader *) datacopy;
|
||||||
uint8_t packettype = rtcpheader->packettype;
|
uint8_t packettype = rtcpheader->packettype;
|
||||||
|
|
|
@ -380,14 +380,14 @@ public:
|
||||||
~RTPUDPv4Transmitter();
|
~RTPUDPv4Transmitter();
|
||||||
|
|
||||||
int Init(bool treadsafe);
|
int Init(bool treadsafe);
|
||||||
int Create(size_t maxpacksize, const RTPTransmissionParams *transparams);
|
int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams);
|
||||||
void Destroy();
|
void Destroy();
|
||||||
RTPTransmissionInfo *GetTransmissionInfo();
|
RTPTransmissionInfo *GetTransmissionInfo();
|
||||||
void DeleteTransmissionInfo(RTPTransmissionInfo *inf);
|
void DeleteTransmissionInfo(RTPTransmissionInfo *inf);
|
||||||
|
|
||||||
int GetLocalHostName(uint8_t *buffer, size_t *bufferlength);
|
int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength);
|
||||||
bool ComesFromThisTransmitter(const RTPAddress *addr);
|
bool ComesFromThisTransmitter(const RTPAddress *addr);
|
||||||
size_t GetHeaderOverhead()
|
std::size_t GetHeaderOverhead()
|
||||||
{
|
{
|
||||||
return RTPUDPV4TRANS_HEADERSIZE;
|
return RTPUDPV4TRANS_HEADERSIZE;
|
||||||
}
|
}
|
||||||
|
@ -396,8 +396,8 @@ public:
|
||||||
int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0);
|
int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0);
|
||||||
int AbortWait();
|
int AbortWait();
|
||||||
|
|
||||||
int SendRTPData(const void *data, size_t len);
|
int SendRTPData(const void *data, std::size_t len);
|
||||||
int SendRTCPData(const void *data, size_t len);
|
int SendRTCPData(const void *data, std::size_t len);
|
||||||
|
|
||||||
int AddDestination(const RTPAddress &addr);
|
int AddDestination(const RTPAddress &addr);
|
||||||
int DeleteDestination(const RTPAddress &addr);
|
int DeleteDestination(const RTPAddress &addr);
|
||||||
|
@ -415,7 +415,7 @@ public:
|
||||||
int AddToAcceptList(const RTPAddress &addr);
|
int AddToAcceptList(const RTPAddress &addr);
|
||||||
int DeleteFromAcceptList(const RTPAddress &addr);
|
int DeleteFromAcceptList(const RTPAddress &addr);
|
||||||
void ClearAcceptList();
|
void ClearAcceptList();
|
||||||
int SetMaximumPacketSize(size_t s);
|
int SetMaximumPacketSize(std::size_t s);
|
||||||
|
|
||||||
bool NewDataAvailable();
|
bool NewDataAvailable();
|
||||||
RTPRawPacket *GetNextPacket();
|
RTPRawPacket *GetNextPacket();
|
||||||
|
@ -449,7 +449,7 @@ private:
|
||||||
RTPTransmitter::ReceiveMode receivemode;
|
RTPTransmitter::ReceiveMode receivemode;
|
||||||
|
|
||||||
uint8_t *localhostname;
|
uint8_t *localhostname;
|
||||||
size_t localhostnamelength;
|
std::size_t localhostnamelength;
|
||||||
|
|
||||||
RTPHashTable<const RTPIPv4Destination, RTPUDPv4Trans_GetHashIndex_IPv4Dest, RTPUDPV4TRANS_HASHSIZE> destinations;
|
RTPHashTable<const RTPIPv4Destination, RTPUDPv4Trans_GetHashIndex_IPv4Dest, RTPUDPV4TRANS_HASHSIZE> destinations;
|
||||||
#ifdef RTP_SUPPORT_IPV4MULTICAST
|
#ifdef RTP_SUPPORT_IPV4MULTICAST
|
||||||
|
@ -458,7 +458,7 @@ private:
|
||||||
std::list<RTPRawPacket*> rawpacketlist;
|
std::list<RTPRawPacket*> rawpacketlist;
|
||||||
|
|
||||||
bool supportsmulticasting;
|
bool supportsmulticasting;
|
||||||
size_t maxpacksize;
|
std::size_t maxpacksize;
|
||||||
|
|
||||||
class PortInfo
|
class PortInfo
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,7 +137,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo
|
||||||
SocketType sock = socket(PF_INET, SOCK_DGRAM, 0);
|
SocketType sock = socket(PF_INET, SOCK_DGRAM, 0);
|
||||||
if (sock == RTPSOCKERR)
|
if (sock == RTPSOCKERR)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET;
|
return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo
|
||||||
if (bind(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) != 0)
|
if (bind(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) != 0)
|
||||||
{
|
{
|
||||||
RTPCLOSE(sock);
|
RTPCLOSE(sock);
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
return ERR_RTP_UDPV4TRANS_CANTGETVALIDSOCKET;
|
return ERR_RTP_UDPV4TRANS_CANTGETVALIDSOCKET;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
{
|
{
|
||||||
RTPCLOSE(sock);
|
RTPCLOSE(sock);
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo
|
||||||
*pRtcpSock = sock;
|
*pRtcpSock = sock;
|
||||||
*pRtpPort = basePort;
|
*pRtpPort = basePort;
|
||||||
*pRtcpPort = basePort;
|
*pRtcpPort = basePort;
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -190,7 +190,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo
|
||||||
if (sock2 == RTPSOCKERR)
|
if (sock2 == RTPSOCKERR)
|
||||||
{
|
{
|
||||||
RTPCLOSE(sock);
|
RTPCLOSE(sock);
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET;
|
return ERR_RTP_UDPV4TRANS_CANTCREATESOCKET;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo
|
||||||
*pRtcpPort = basePort;
|
*pRtcpPort = basePort;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -249,13 +249,13 @@ int RTPUDPv4TransmitterNoBind::GetAutoSockets(uint32_t bindIP, bool allowOdd, bo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < toClose.size(); i++)
|
for (std::size_t i = 0; i < toClose.size(); i++)
|
||||||
RTPCLOSE(toClose[i]);
|
RTPCLOSE(toClose[i]);
|
||||||
|
|
||||||
return ERR_RTP_UDPV4TRANS_TOOMANYATTEMPTSCHOOSINGSOCKET;
|
return ERR_RTP_UDPV4TRANS_TOOMANYATTEMPTSCHOOSINGSOCKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4TransmitterNoBind::Create(size_t maximumpacketsize, const RTPTransmissionParams *transparams)
|
int RTPUDPv4TransmitterNoBind::Create(std::size_t maximumpacketsize, const RTPTransmissionParams *transparams)
|
||||||
{
|
{
|
||||||
const RTPUDPv4TransmissionNoBindParams *params, defaultparams;
|
const RTPUDPv4TransmissionNoBindParams *params, defaultparams;
|
||||||
// struct sockaddr_in addr;
|
// struct sockaddr_in addr;
|
||||||
|
@ -557,7 +557,7 @@ void RTPUDPv4TransmitterNoBind::DeleteTransmissionInfo(RTPTransmissionInfo *i)
|
||||||
delete i;
|
delete i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4TransmitterNoBind::GetLocalHostName(uint8_t *buffer, size_t *bufferlength)
|
int RTPUDPv4TransmitterNoBind::GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
|
@ -833,7 +833,7 @@ int RTPUDPv4TransmitterNoBind::AbortWait()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4TransmitterNoBind::SendRTPData(const void *data, size_t len)
|
int RTPUDPv4TransmitterNoBind::SendRTPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
|
@ -859,7 +859,7 @@ int RTPUDPv4TransmitterNoBind::SendRTPData(const void *data, size_t len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4TransmitterNoBind::SendRTCPData(const void *data, size_t len)
|
int RTPUDPv4TransmitterNoBind::SendRTCPData(const void *data, std::size_t len)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
|
@ -1250,7 +1250,7 @@ void RTPUDPv4TransmitterNoBind::ClearAcceptList()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int RTPUDPv4TransmitterNoBind::SetMaximumPacketSize(size_t s)
|
int RTPUDPv4TransmitterNoBind::SetMaximumPacketSize(std::size_t s)
|
||||||
{
|
{
|
||||||
if (!init)
|
if (!init)
|
||||||
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
return ERR_RTP_UDPV4TRANS_NOTINIT;
|
||||||
|
@ -1354,7 +1354,7 @@ int RTPUDPv4TransmitterNoBind::PollSocket(bool rtp)
|
||||||
SOCKET sock;
|
SOCKET sock;
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
#else
|
#else
|
||||||
size_t len;
|
std::size_t len;
|
||||||
int sock;
|
int sock;
|
||||||
#endif // RTP_SOCKETTYPE_WINSOCK
|
#endif // RTP_SOCKETTYPE_WINSOCK
|
||||||
struct sockaddr_in srcaddr;
|
struct sockaddr_in srcaddr;
|
||||||
|
@ -1427,7 +1427,7 @@ int RTPUDPv4TransmitterNoBind::PollSocket(bool rtp)
|
||||||
{
|
{
|
||||||
isrtp = true;
|
isrtp = true;
|
||||||
|
|
||||||
if ((size_t) recvlen > sizeof(RTCPCommonHeader))
|
if ((std::size_t) recvlen > sizeof(RTCPCommonHeader))
|
||||||
{
|
{
|
||||||
RTCPCommonHeader *rtcpheader = (RTCPCommonHeader *) datacopy;
|
RTCPCommonHeader *rtcpheader = (RTCPCommonHeader *) datacopy;
|
||||||
uint8_t packettype = rtcpheader->packettype;
|
uint8_t packettype = rtcpheader->packettype;
|
||||||
|
|
|
@ -382,16 +382,16 @@ public:
|
||||||
~RTPUDPv4TransmitterNoBind();
|
~RTPUDPv4TransmitterNoBind();
|
||||||
|
|
||||||
int Init(bool treadsafe);
|
int Init(bool treadsafe);
|
||||||
int Create(size_t maxpacksize, const RTPTransmissionParams *transparams);
|
int Create(std::size_t maxpacksize, const RTPTransmissionParams *transparams);
|
||||||
/** Bind the RTP and RTCP sockets to ports defined in the transmission parameters */
|
/** Bind the RTP and RTCP sockets to ports defined in the transmission parameters */
|
||||||
int BindSockets(const RTPTransmissionParams *transparams);
|
int BindSockets(const RTPTransmissionParams *transparams);
|
||||||
void Destroy();
|
void Destroy();
|
||||||
RTPTransmissionInfo *GetTransmissionInfo();
|
RTPTransmissionInfo *GetTransmissionInfo();
|
||||||
void DeleteTransmissionInfo(RTPTransmissionInfo *inf);
|
void DeleteTransmissionInfo(RTPTransmissionInfo *inf);
|
||||||
|
|
||||||
int GetLocalHostName(uint8_t *buffer, size_t *bufferlength);
|
int GetLocalHostName(uint8_t *buffer, std::size_t *bufferlength);
|
||||||
bool ComesFromThisTransmitter(const RTPAddress *addr);
|
bool ComesFromThisTransmitter(const RTPAddress *addr);
|
||||||
size_t GetHeaderOverhead()
|
std::size_t GetHeaderOverhead()
|
||||||
{
|
{
|
||||||
return RTPUDPV4TRANSNOBIND_HEADERSIZE;
|
return RTPUDPV4TRANSNOBIND_HEADERSIZE;
|
||||||
}
|
}
|
||||||
|
@ -400,8 +400,8 @@ public:
|
||||||
int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0);
|
int WaitForIncomingData(const RTPTime &delay, bool *dataavailable = 0);
|
||||||
int AbortWait();
|
int AbortWait();
|
||||||
|
|
||||||
int SendRTPData(const void *data, size_t len);
|
int SendRTPData(const void *data, std::size_t len);
|
||||||
int SendRTCPData(const void *data, size_t len);
|
int SendRTCPData(const void *data, std::size_t len);
|
||||||
|
|
||||||
int AddDestination(const RTPAddress &addr);
|
int AddDestination(const RTPAddress &addr);
|
||||||
int DeleteDestination(const RTPAddress &addr);
|
int DeleteDestination(const RTPAddress &addr);
|
||||||
|
@ -419,7 +419,7 @@ public:
|
||||||
int AddToAcceptList(const RTPAddress &addr);
|
int AddToAcceptList(const RTPAddress &addr);
|
||||||
int DeleteFromAcceptList(const RTPAddress &addr);
|
int DeleteFromAcceptList(const RTPAddress &addr);
|
||||||
void ClearAcceptList();
|
void ClearAcceptList();
|
||||||
int SetMaximumPacketSize(size_t s);
|
int SetMaximumPacketSize(std::size_t s);
|
||||||
|
|
||||||
bool NewDataAvailable();
|
bool NewDataAvailable();
|
||||||
RTPRawPacket *GetNextPacket();
|
RTPRawPacket *GetNextPacket();
|
||||||
|
@ -453,7 +453,7 @@ private:
|
||||||
RTPTransmitter::ReceiveMode receivemode;
|
RTPTransmitter::ReceiveMode receivemode;
|
||||||
|
|
||||||
uint8_t *localhostname;
|
uint8_t *localhostname;
|
||||||
size_t localhostnamelength;
|
std::size_t localhostnamelength;
|
||||||
|
|
||||||
RTPHashTable<const RTPIPv4Destination, RTPUDPv4TransNoBind_GetHashIndex_IPv4Dest, RTPUDPV4TRANSNOBIND_HASHSIZE> destinations;
|
RTPHashTable<const RTPIPv4Destination, RTPUDPv4TransNoBind_GetHashIndex_IPv4Dest, RTPUDPV4TRANSNOBIND_HASHSIZE> destinations;
|
||||||
#ifdef RTP_SUPPORT_IPV4MULTICAST
|
#ifdef RTP_SUPPORT_IPV4MULTICAST
|
||||||
|
@ -462,7 +462,7 @@ private:
|
||||||
std::list<RTPRawPacket*> rawpacketlist;
|
std::list<RTPRawPacket*> rawpacketlist;
|
||||||
|
|
||||||
bool supportsmulticasting;
|
bool supportsmulticasting;
|
||||||
size_t maxpacksize;
|
std::size_t maxpacksize;
|
||||||
|
|
||||||
class PortInfo
|
class PortInfo
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue