mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 22:21:13 +00:00
rtpst2022-1-fecenc: memset when reallocating xored payload
When protecting packets with a variable payload length, we reallocate the xored payload when needed. It is a good idea to memset the extended memory to 0 so that we don't xor data with garbage! Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/839>
This commit is contained in:
parent
081509e030
commit
6d98415fd4
1 changed files with 9 additions and 6 deletions
|
@ -266,20 +266,23 @@ fec_packet_update (FecPacket * fec, GstRTPBuffer * rtp)
|
||||||
memcpy (fec->xored_payload, gst_rtp_buffer_get_payload (rtp),
|
memcpy (fec->xored_payload, gst_rtp_buffer_get_payload (rtp),
|
||||||
fec->payload_len);
|
fec->payload_len);
|
||||||
} else {
|
} else {
|
||||||
if (fec->payload_len < gst_rtp_buffer_get_payload_len (rtp)) {
|
guint plen = gst_rtp_buffer_get_payload_len (rtp);
|
||||||
fec->payload_len = gst_rtp_buffer_get_payload_len (rtp);
|
|
||||||
|
if (fec->payload_len < plen) {
|
||||||
fec->xored_payload =
|
fec->xored_payload =
|
||||||
g_realloc (fec->xored_payload, sizeof (guint8) * fec->payload_len);
|
g_realloc (fec->xored_payload, sizeof (guint8) * plen);
|
||||||
|
memset (fec->xored_payload + fec->payload_len, 0,
|
||||||
|
plen - fec->payload_len);
|
||||||
|
fec->payload_len = plen;
|
||||||
}
|
}
|
||||||
|
|
||||||
fec->xored_payload_len ^= gst_rtp_buffer_get_payload_len (rtp);
|
fec->xored_payload_len ^= plen;
|
||||||
fec->xored_pt ^= gst_rtp_buffer_get_payload_type (rtp);
|
fec->xored_pt ^= gst_rtp_buffer_get_payload_type (rtp);
|
||||||
fec->xored_timestamp ^= gst_rtp_buffer_get_timestamp (rtp);
|
fec->xored_timestamp ^= gst_rtp_buffer_get_timestamp (rtp);
|
||||||
_xor_mem (fec->xored_payload, gst_rtp_buffer_get_payload (rtp),
|
|
||||||
gst_rtp_buffer_get_payload_len (rtp));
|
|
||||||
fec->xored_marker ^= gst_rtp_buffer_get_marker (rtp);
|
fec->xored_marker ^= gst_rtp_buffer_get_marker (rtp);
|
||||||
fec->xored_padding ^= gst_rtp_buffer_get_padding (rtp);
|
fec->xored_padding ^= gst_rtp_buffer_get_padding (rtp);
|
||||||
fec->xored_extension ^= gst_rtp_buffer_get_extension (rtp);
|
fec->xored_extension ^= gst_rtp_buffer_get_extension (rtp);
|
||||||
|
_xor_mem (fec->xored_payload, gst_rtp_buffer_get_payload (rtp), plen);
|
||||||
}
|
}
|
||||||
|
|
||||||
fec->n_packets += 1;
|
fec->n_packets += 1;
|
||||||
|
|
Loading…
Reference in a new issue