Skip to content

Include RTP padding in feedback and pacing byte counts - #497

Open
Awuqing wants to merge 1 commit into
pion:mainfrom
Awuqing:fix/rtp-padding-accounting
Open

Awuqing wants to merge 1 commit into
pion:mainfrom
Awuqing:fix/rtp-padding-accounting

Conversation

@Awuqing

@Awuqing Awuqing commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

RTP padding reaches the wire but is missing from the byte counts in rtpfb and pacing. A packet with a 20-byte header and 255 bytes of padding is recorded and charged as 20 bytes. This understates the delivery rate and allows padding traffic to exceed the configured pacing budget.

Include Header.PaddingSize in both TWCC and CCFB send history, the pacer's queued-write result, and its packet size calculation. The latter also feeds the budget check and burst growth. There are no API or dependency changes.

The regressions compare against serialized RTP for zero, one, and 255 padding bytes, including empty and nonempty payloads. The pacing test also checks the charged bits and packet contents.

Validation: both affected packages pass go test -race -count=10; golangci-lint 2.10.1 reports 0 issues. A separate V5 PeerConnection test using virtual networking passes three runs in both TWCC and CCFB modes. At 100 kbit/s, 100 TWCC padding packets contain 27,500 RTP bytes: the original code reports 2,000 bytes and sends them in 35 ms; the fix reports 27,500 bytes and spreads them over 2.075 s, within the token bucket allowance. This accounting excludes SRTP, UDP and IP overhead. This PR does not add probing; the end-to-end regression uses virtual networking and does not establish real-network recovery.

Count Header.PaddingSize in TWCC and CCFB send history and in the
pacer's queued-write result and packet budget calculation.

Compare zero and nonzero padding against serialized RTP and verify
that pacing charges the complete packet size.
@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.68%. Comparing base (3084336) to head (b306cd3).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #497      +/-   ##
==========================================
- Coverage   86.71%   86.68%   -0.03%     
==========================================
  Files          91       91              
  Lines        4154     4154              
==========================================
- Hits         3602     3601       -1     
- Misses        552      553       +1     
Flag Coverage Δ
go 86.68% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Awuqing
Awuqing marked this pull request as ready for review October 30, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant