Skip to content

Always use 2-byte PictureID in VP8Payloader - #377

Merged
fippo merged 1 commit into
mainfrom
vp8-two-byte-pictureid
Oct 8, 2026
Merged

fippo merged 1 commit into
mainfrom
vp8-two-byte-pictureid

Conversation

@fippo

@fippo fippo commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

With EnablePictureID, PictureIDs below 128 were sent in the 1-byte (7-bit) form and larger ones in the 2-byte (15-bit) form. Both are valid per RFC 7741, but the changing descriptor size means an SFU that rewrites PictureIDs, e.g. when switching simulcast layers, may have to grow or shrink the packet instead of overwriting two bytes in place.

libwebrtc changed to always sending the 2-byte form in
https://webrtc.googlesource.com/src/+/eb94436b386afb7165d91724893b6085365ca1ad

@fippo

fippo commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

(and yup, libWebRTC is in violation of RFC 7741)

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.48%. Comparing base (cbf78a2) to head (d564428).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #377   +/-   ##
=======================================
  Coverage   87.48%   87.48%           
=======================================
  Files          28       28           
  Lines        3172     3165    -7     
=======================================
- Hits         2775     2769    -6     
+ Misses        397      396    -1     
Flag Coverage Δ
go 87.48% <100.00%> (+<0.01%) ⬆️

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.

With EnablePictureID, PictureIDs below 128 were sent in the 1-byte
(7-bit) form and larger ones in the 2-byte (15-bit) form. Both are
valid per RFC 7741, but the changing descriptor size means an SFU that
rewrites PictureIDs, e.g. when switching simulcast layers, may have to
grow or shrink the packet instead of overwriting two bytes in place.

libwebrtc changed to always sending the 2-byte form in commit
  https://webrtc.googlesource.com/src/+/eb94436b386a
@fippo
fippo force-pushed the vp8-two-byte-pictureid branch from 2a35ea0 to d564428 Compare October 8, 2026 10:55

@JoTurk JoTurk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's expected for SFUs to handle this correctly, Since the spec mentions it explicitly? example livekit https://github.com/livekit/livekit/blob/master/pkg/sfu/codecmunger/vp8.go#L192

The receiver MUST NOT assume that the number of bits in PictureID stays the same through the session

I think it's generally bad to adjust our code to bad / lazy implementations that violates specs, but as you said "(and yup, libWebRTC is in violation of RFC 7741)", and it's small change that doesn't break anything so LGTM :)

thank you.

@fippo

fippo commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

well, this simply avoids the problem, pragmatic @ggarber style ;-)

@fippo
fippo merged commit 3a98767 into main Oct 8, 2026
19 checks passed
@fippo
fippo deleted the vp8-two-byte-pictureid branch October 8, 2026 12:29
JoTurk added a commit to pion/webrtc that referenced this pull request Oct 21, 2026
JoTurk added a commit to pion/webrtc that referenced this pull request Oct 21, 2026
JoTurk added a commit to pion/webrtc that referenced this pull request Oct 21, 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.

2 participants