- more RTP manipulation abilities + cleanups

This commit is contained in:
2023-03-13 17:27:58 +03:00
parent 5bbdec8452
commit 1b41ac9e16
11 changed files with 146 additions and 125 deletions

View File

@@ -126,11 +126,11 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
return ERR_RTP_PACKET_INVALIDPACKET;
// The length should be at least the size of the RTP header
packetlen = rawpack.GetDataLength();
packetlen = rawpack.GetDataLength();
if (packetlen < sizeof(RTPHeader))
return ERR_RTP_PACKET_INVALIDPACKET;
packetbytes = (uint8_t *)rawpack.GetData();
packetbytes = (uint8_t *)rawpack.GetData();
rtpheader = (RTPHeader *)packetbytes;
// The version number should be correct
@@ -208,7 +208,7 @@ int RTPPacket::ParseRawPacket(RTPRawPacket &rawpack)
RTPPacket::payloadlength = payloadlength;
// We'll zero the data of the raw packet, since we're using it here now!
rawpack.ZeroData();
rawpack.ZeroData();
return 0;
}

View File

@@ -119,6 +119,7 @@ public:
/** Returns the SSRC identifier stored in this packet. */
uint32_t GetSSRC() const { return ssrc; }
void SetSSRC(uint32_t ssrc) { this->ssrc = ssrc; }
/** Returns a pointer to the data of the entire packet. */
uint8_t *GetPacketData() const { return packet; }
@@ -131,7 +132,7 @@ public:
/** Returns the payload length. */
size_t GetPayloadLength() const { return payloadlength; }
void SetPayloadLength(size_t l) { payloadlength = l; }
void SetPayloadLength(size_t l) { payloadlength = l; }
/** If a header extension is present, this function returns the extension identifier. */
uint16_t GetExtensionID() const { return extid; }

View File

@@ -58,7 +58,7 @@ public:
* 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.
*/
RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp,RTPMemoryManager *mgr = 0);
RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,const RTPTime &recvtime,bool rtp,RTPMemoryManager *mgr = 0);
~RTPRawPacket();
/** Returns the pointer to the data which is contained in this packet. */
@@ -92,12 +92,13 @@ private:
bool isrtp;
};
inline RTPRawPacket::RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address,RTPTime &recvtime,bool rtp,RTPMemoryManager *mgr):RTPMemoryObject(mgr),receivetime(recvtime)
inline RTPRawPacket::RTPRawPacket(uint8_t *data,size_t datalen,RTPAddress *address, const RTPTime &recvtime,bool rtp,RTPMemoryManager *mgr):RTPMemoryObject(mgr),receivetime(recvtime)
{
packetdata = data;
packetdatalength = datalen;
senderaddress = address;
isrtp = rtp;
receivetime = recvtime;
}
inline RTPRawPacket::~RTPRawPacket()