Skip to content

Limit pacer burst size at high bitrates - #1058

Merged
algesten merged 3 commits into
algesten:mainfrom
hsdfat:pacer-max-burst
Sep 27, 2026
Merged

algesten merged 3 commits into
algesten:mainfrom
hsdfat:pacer-max-burst

Conversation

@hsdfat

@hsdfat hsdfat commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #827

As suggested by @k0nserv in #823, cap paced media bursts so high bitrates do
not overfill socket buffers.

The leaky bucket pacer previously let media debt grow to a full 40 ms pacing
interval before waiting, or about 250 kB at 50 Mbps. Set MAX_BURST_SIZE to
63,000 bytes, as in libwebrtc's PacingController, and use the smaller of the
40 ms interval and MAX_BURST_SIZE / adjusted_bitrate. Wait when debt reaches
that interval, matching libwebrtc's NextSendTime() boundary.

Below about 12.6 Mbps, the 40 ms interval remains the limit. At an exact
interval boundary, the pacer now stops one packet earlier. Padding and probe
timing are unchanged.

hsdfat and others added 3 commits September 26, 2026 18:54
The leaky bucket pacer lets media debt grow to a full PACING interval
(40 ms) before it waits. At 50 Mbps that is a 250 kB burst, which risks
overfilling socket buffers.

Cap the burst interval at MAX_BURST_SIZE / adjusted_bitrate, with
MAX_BURST_SIZE = 63 kB as in libwebrtc's PacingController::kMaxBurstSize.
Below ~12.6 Mbps PACING is still the smaller of the two, so behaviour
there is unchanged. Probing and padding timing are not affected.

Closes algesten#827

@algesten algesten left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks!

@algesten
algesten merged commit b8f13c1 into algesten:main Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add max burst size limit to pacer

2 participants