Store pointer to the datagram in the rtp_frame structure
Auxiliary handlers may need access to the original block of memory (such as SRTP) so instead of relaying that parameter to every handler, store pointer to the block inside the RTP frame. The pointer is valid as long as the packet is being processed and the last handler should set it to nullptr. Some changes to the public frame should be made because a lot of the fields in the frames used by uvgRTP are not important outside the library.
This commit is contained in:
parent
7105da93e4
commit
1efc8b6049
|
@ -81,6 +81,9 @@ namespace uvg_rtp {
|
|||
uint8_t *probation;
|
||||
uint8_t *payload;
|
||||
|
||||
uint8_t *dgram; /* pointer to the UDP datagram (for internal use only) */
|
||||
size_t dgram_size; /* size of the UDP datagram */
|
||||
|
||||
rtp_format_t format;
|
||||
int type;
|
||||
sockaddr_in src_addr;
|
||||
|
|
|
@ -216,6 +216,9 @@ rtp_error_t uvg_rtp::rtp::packet_handler(ssize_t size, void *packet, int flags,
|
|||
(*out)->padding_len = padding_len;
|
||||
}
|
||||
|
||||
(*out)->payload = (uint8_t *)memdup(ptr, (*out)->payload_len);
|
||||
(*out)->payload = (uint8_t *)memdup(ptr, (*out)->payload_len);
|
||||
(*out)->dgram = (uint8_t *)packet;
|
||||
(*out)->dgram_size = size;
|
||||
|
||||
return RTP_PKT_MODIFIED;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue