mirror of
https://github.com/livekit/livekit.git
synced 2026-04-01 10:55:45 +00:00
* Prevent rtx buffer and forwarding path colliding Received packets are put into RTX buffer which is a circular buffer and the packet (sequence number) is queued for forwarding. If the RTX buffer fills up and cycles before forwarding happens, forwarding would pick the wrong packet (as it is holding a reference to a byte slice in the RTX buffer) to forward. Prevent it by moving reading from RTX buffer just before forwarding. Adds an extra copy from RTX buffer -> temp buffer for forwarding, but ensures that forwarding buffer is not used by another go routine. * Revert some changes from previous commit Details: - Do all forward processing as before. - One difference is not load raw packet into ExtPacket. - Load raw packet into provided buffer when module that reads using ReadExtended calls that function. If the packet is not there in the retransmission buffer, that packet will be dropped. This is the case we are trying to fix, i. e. the RTX buffer has cycled before ReadExtended could pull the packet. This makes a copy into the provided buffer so that the data does not change underneath. * Remove debug comment * Oops missed a function call
5.7 KiB
5.7 KiB