72 const void *payloaddata,
73 unsigned int payloadlen,
83 const void *extensiondata,
84 unsigned int maxpacksize) :
100 extensionlen_numwords,
108 const void *payloaddata,
109 unsigned int payloadlen,
119 const void *extensiondata,
121 unsigned int buffersize) :
127 else if (buffersize <= 0)
142 extensionlen_numwords,
151 unsigned int packetlen;
161 if (!rawpack.
IsRTP())
179 marker = (rtpheader->
marker == 0) ?
false :
true;
194 numpadbytes = (int) packetbytes[packetlen - 1];
195 if (numpadbytes <= 0)
201 hasextension = (rtpheader->
extension == 0) ?
false :
true;
208 payloadoffset += ((int) exthdrlen) *
sizeof(
uint32_t);
215 payloadlength = packetlen - numpadbytes - payloadoffset;
216 if (payloadlength < 0)
266 const void *payloaddata,
267 unsigned int payloadlen,
277 const void *extensiondata,
279 unsigned int maxsize)
284 if (payloadtype > 127)
286 if (payloadtype == 72 || payloadtype == 73)
344 rtphdr->
timestamp = qToBigEndian(timestamp);
345 rtphdr->
ssrc = qToBigEndian(ssrc);
351 for (i = 0; i <
numcsrcs; i++, curcsrc++)
352 *curcsrc = qToBigEndian(csrcs[i]);
359 rtpexthdr->
extid = qToBigEndian(extensionid);
360 rtpexthdr->
length = qToBigEndian((
uint16_t) extensionlen_numwords);
367 memcpy(
payload, payloaddata, payloadlen);
#define ERR_RTP_PACKET_INVALIDPACKET
T qToHost(const T &x) const
unsigned int extensionlength
#define ERR_RTP_PACKET_ILLEGALBUFFERSIZE
RTPPacket(RTPRawPacket &rawpack)
int BuildPacket(uint8_t payloadtype, const void *payloaddata, unsigned int 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, unsigned int maxsize)
#define ERR_RTP_PACKET_TOOMANYCSRCS
unsigned int packetlength
RTPTime GetReceiveTime() const
#define ERR_RTP_PACKET_EXTERNALBUFFERNULL
#define ERR_RTP_PACKET_DATAEXCEEDSMAXSIZE
std::size_t GetDataLength() const
unsigned int payloadlength
int ParseRawPacket(RTPRawPacket &rawpack)
#define ERR_RTP_PACKET_BADPAYLOADTYPE
uint32_t GetCSRC(int num) const