Files
livekit/scripts/flexfec/flexfec-local.yaml
T
2026-06-06 10:15:47 -07:00

49 lines
2.0 KiB
YAML

# Local FlexFEC-03 test config for the LiveKit SFU.
#
# Intended to be run together with `--dev` (which injects the devkey/secret API key
# pair and binds to loopback):
#
# go run ./cmd/server --dev --config scripts/flexfec/flexfec-local.yaml
#
# Media is pinned to a single UDP port on loopback so traffic shaping (see netem.sh)
# can target it deterministically.
port: 7880
rtc:
# Single, fixed media port (no port_range_* so this takes effect). Shape this port
# with scripts/flexfec/netem.sh to simulate packet loss.
udp_port: 7882
tcp_port: 7881
# Keep everything on the local machine; do not try to discover a public IP.
use_external_ip: false
# Gather loopback (127.0.0.1) candidates and pin ICE to IPv4 loopback so all media flows
# over a single, stable path. NOTE: on an all-on-one-box macOS setup, pf/dummynet
# (netem.sh) cannot shape this traffic -- the kernel short-circuits same-host UDP delivery
# before the pf hook -- so loss/delay is injected in-SFU instead via the LK_DOWNLINK_*
# env vars (see pkg/sfu/downtrack_impair.go and run-sfu.sh). The media path is therefore
# irrelevant to shaping, so loopback (no dependency on a volatile LAN IP) is preferred.
enable_loopback_candidate: true
ips:
includes:
- 127.0.0.0/8
# FlexFEC-03 for both directions:
# publisher: receive + decode a publisher's repair stream (uplink recovery)
# subscriber: generate a repair stream per subscriber (downlink recovery)
flexfec:
subscriber: false
publisher: true
payload_type: 49
# Low-latency teleop tuning: 5-packet block with 1 repair = 20% overhead, but the
# repair lands ~16ms after the block (vs ~32ms for a 10-block), well under an 80ms
# RTX round trip. Recovers 1 scattered loss per 5-block (ample for ~1% random loss).
num_media_packets: 5
num_fec_packets: 1
logging:
# info surfaces the "flexfec decoder enabled" and periodic "flexfec recovery stats"
# logs. Bump to debug to also see SDP-level FEC negotiation ("flexfec ... from sdp").
level: debug
json: false