feat: rtp extension profile

This commit is contained in:
ireader
2022-06-04 16:35:27 +08:00
parent 04fc06d7e7
commit fdee5c7b82
2 changed files with 3 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ struct rtp_packet_t
uint32_t csrc[16];
const void* extension; // extension(valid only if rtp.x = 1)
uint16_t extlen; // extension length in bytes
uint16_t reserved; // extension reserved
uint16_t extprofile; // extension reserved
const void* payload; // payload
int payloadlen; // payload length in bytes
};

View File

@@ -64,7 +64,7 @@ int rtp_packet_deserialize(struct rtp_packet_t *pkt, const void* data, int bytes
const uint8_t *rtpext = ptr + hdrlen;
assert(pkt->payloadlen >= 4);
pkt->extension = rtpext + 4;
pkt->reserved = nbo_r16(rtpext);
pkt->extprofile = nbo_r16(rtpext);
pkt->extlen = nbo_r16(rtpext + 2) * 4;
if (pkt->extlen + 4 > pkt->payloadlen)
{
@@ -128,7 +128,7 @@ int rtp_packet_serialize_header(const struct rtp_packet_t *pkt, void* data, int
{
// 5.3.1 RTP Header Extension
assert(0 == (pkt->extlen % 4));
nbo_w16(ptr, pkt->reserved);
nbo_w16(ptr, pkt->extprofile);
nbo_w16(ptr + 2, pkt->extlen / 4);
memcpy(ptr + 4, pkt->extension, pkt->extlen);
ptr += pkt->extlen + 4;