Documentation
¶
Overview ¶
Package main demonstrates the two ways gopus recovers from a lost packet on a real (lossy) network: packet loss concealment and in-band forward error correction.
PLC (packet loss concealment): when a packet never arrives, call Decode(nil, pcm). The decoder synthesizes a replacement frame from its internal state, keeping the stream continuous instead of inserting a gap.
FEC (forward error correction): enabling in-band FEC lets the encoder include a low-bitrate copy (LBRR) of the previous audio. If frame N is lost, call DecodeWithFEC(packetN+1, pcm, true) to recover it from the next packet, then Decode(packetN+1, pcm) for that packet's primary audio. The decoder uses PLC when the packet has no usable redundancy.
This example selects a speech-oriented SILK stream and a nonzero expected loss percentage to encourage LBRR. Enabling FEC does not guarantee that every packet contains redundancy.
Usage:
go run ./examples/packet-loss