Skip to content

Commit f14a243

Browse files
srperensclaude
andauthored
fix(whep): re-enable RTX retransmission, keep FEC disabled (#629)
PR #216 disabled both FEC and RTX to stop bandwidth doubling on high-bitrate pre-encoded streams. The doubling came from FEC's constant proactive redundancy — RTX was disabled alongside it without being the culprit. RTX is reactive: it costs nothing while no packets are lost and only resends the exact packets the client NACKs. Without RTX, client NACKs go unanswered, so every burst loss escalates to PLI -> forced keyframe, leaving the picture broken until the keyframe arrives (observed as fps drops from 50 to 3-9 in client stats). Field-verified on a lossy viewer path: with RTX enabled the client holds 44-50 fps through loss bursts and only ~1 in 5 bursts still escalates to PLI, at a retransmission cost proportional to actual loss (zero on clean paths). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 90e5a24 commit f14a243

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

backend/src/blocks/builtin/whep.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,13 +1021,16 @@ fn build_whepserversink(
10211021
whepserversink.set_property("turn-servers", turn_servers);
10221022
}
10231023

1024-
// Disable FEC and RTX (retransmission) to avoid bandwidth overhead
1025-
// These are enabled by default in webrtcsink and can significantly increase bandwidth:
1026-
// - FEC adds redundancy packets (can add ~50% overhead)
1027-
// - RTX sends duplicate packets for retransmission
1028-
// For pre-encoded video at high bitrates, these can cause near-double bandwidth usage
1024+
// Disable FEC but keep RTX (retransmission) enabled.
1025+
// - FEC adds proactive redundancy packets on every stream (~50% constant
1026+
// overhead, near-double bandwidth for pre-encoded high-bitrate video),
1027+
// so it stays off.
1028+
// - RTX is reactive: it costs nothing while no packets are lost and only
1029+
// resends the exact packets the client NACKs. Without it, every loss
1030+
// escalates to PLI -> forced keyframe, which is far more expensive and
1031+
// leaves the picture broken until the keyframe arrives.
10291032
whepserversink.set_property("do-fec", false);
1030-
whepserversink.set_property("do-retransmission", false);
1033+
whepserversink.set_property("do-retransmission", true);
10311034

10321035
// Access the signaller child and set its properties
10331036
// Bind to localhost only - axum will proxy external requests

0 commit comments

Comments
 (0)