Give the stream sockets room for high-bitrate bursts
Watching an official client's 1440p60 H.264 stream (6-9 Mbit/s) showed a very bad frame rate. The peer sockets used the system's default buffers (208 KB on Linux, about 90 full-size packets once the kernel's per-packet overhead is counted), so a keyframe of hundreds of packets that arrives while the peer task is busy overflows them, and every packet the kernel drops costs the viewer a retransmission or a keyframe. Each peer socket now asks for 4 MB of receive and send buffer (PeerConfig::udp_buffer; the kernel caps it at rmem_max/wmem_max). What the system granted is logged, and once per process with a sysctl hint when it is less than asked. Measured on loopback, 9 Mbit/s of noise at 60 fps with a 400 KB keyframe every second, unpaced (high_bitrate_bursts, --ignored): with the default buffers the kernel dropped 118-209 datagrams per 5 s and 3 of 300 frames arrived after a gap; asking for 212992 bytes (what a default rmem_max allows, doubled by Linux) or for 4 MB, nothing was dropped and every frame arrived whole. Also checked: our answer to a real libwebrtc offer (headless Chromium 152, H.264 first, stored as a fixture) keeps nack, nack pli, transport-cc and an RTX payload type for every H.264 variant, and a relay that loses one media packet in 25 shows str0m's NACK and retransmissions repairing every loss before its depacketizer gives up (30 frames). The relay (tests/relay) also serves the fallback tests that follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b20da22d8
commit
ba6142e12e
6 files changed
+625
-3
No files matched your search
Generated
+1
@@ -9652,6 +9652,7 @@ dependencies = [
|
||||
"futures",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"socket2",
|
||||
"str0m",
|
||||
"thiserror 2.0.21",
|
||||
"tokio",
|
||||
|
||||
Reference in new issue
Block a user