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): when the encoder is configured with in-band FEC, each packet carries a low-bitrate copy (LBRR) of the PREVIOUS frame. If frame N is lost, the next packet (N+1) can reconstruct it: call DecodeWithFEC(packetN+1, pcm, true) to emit the recovered frame N, then Decode(packetN+1, pcm) to emit frame N+1 normally.
FEC needs a speech-oriented SILK stream (set up below) and a non-zero expected packet-loss percentage so the encoder spends bits on LBRR.
Usage:
go run ./examples/packet-loss