Commit Graph
3 Commits
Author SHA1 Message Date
David Chen 7b02897ce2 Align downstream FEC grouping with frame boundaries
Generate repairs at each frame marker, splitting large frames into blocks of at most 48 packets. Match upstream Q8 repair-count rounding and minimum-one protection, and lazily reuse packet buffers.

Reserve measured RTP repair overhead during layer allocation so small frames have enough headroom. Cover sparse frames, large-frame tails, buffer reuse, real Pion wire recovery, and live preset changes.
2026-09-12 14:24:34 -07:00
David Chen d269ac59dd Preserve FEC sender state and harden subscription updates
Carry repair sequence state through the existing DownTrack GetState/SeedState
handoff so cached transceiver reuse preserves SRTP sequence continuity. Close
the old encoder before saving its sequence, and allocate its media group only
when protection is first used.

Apply subscriber settings from one immutable snapshot and discard superseded
updates. Preserve upstream FEC on shared sendrecv codec lists when downstream
generation is disabled. Lock the source RTP stats while seeding a replacement
sender to avoid racing its final snapshot update.

Align field and import grouping with the surrounding implementation. Add
regressions for sequence wrap/rebind, SRTP sender reuse, concurrent settings,
superseded updates, and independent negotiation flags.

Validation: full race suites passed for pkg/sfu/flexfec, pkg/sfu/pacer,
pkg/sfu/rtpstats, pkg/sfu, and pkg/rtc. Encoder benchmarks remain approximately
1.9-2.5 us per five 1200-byte media packets at low/medium/high protection;
disabled encoding has zero allocations.
2026-09-12 11:44:49 -07:00
David Chen 38a675025d Generate downstream FlexFEC with per-track protection presets 2026-09-12 10:51:44 -07:00