How are retransmissions implemented in WebRTC
Executive Summary: This ended up being more complex than expected, if you are building an SFU just take the nack_module.cc & co files and use them. Or even better, just use OpenTok or any other existing platform. Anyway it is fun stuff to play with. Introduction When your network is congested and some of the packets are lost you need a mechanism to recover them. If we ignore signal processing tricks (like stretching the previous and next audio packets in the jitter buffer) there are two alternatives: Forward error correction : in each packet you add some extra information about the previous ones in case they are lost and you need to reconstruct them (flexfec is the new format to do this in WebRTC [1]). Retransmissions : the sender will resend the packets usually after the receiver requests that with a negative acknowledgement message (NACK) indicating which packets were lost. These mechanisms can be combined depending on the network conditions and can a...