Repository navigation
sfu: filter VP8 temporal layers by frame when the dependency descriptor is sent - #4976
Conversation
…or is sent With the dependency descriptor, libwebrtc sends a one byte VP8 payload descriptor without a picture ID, so the VP8 munger's picture ID based temporal drop logic stops filtering after the first gap. A new VP8DD codec munger decides once per frame from the descriptor's frame number and temporal ID and applies that decision to every packet of the frame. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| case snOutOfOrder: | ||
| return 0, hdr, 0, ErrFilteredVP8OutOfOrder |
There was a problem hiding this comment.
🔴 Late filtered frames stall VP8 playback
When a filtered frame arrives late, VP8DD drops its packet without filling the reserved RTP sequence slot. The subscriber cannot recover that slot and can stall until a key frame.
Learn more
The RTP munger maps out-of-order incoming packets onto outgoing sequence numbers before the codec munger filters them. An out-of-order filtered packet therefore leaves a hole in the subscriber's RTP sequence space. translateCodecHeader suppresses this error without repairing that hole; unlike an in-order drop, the existing PacketDropped operation cannot roll back an older slot. The subscriber does not receive VP8 picture IDs in the minimized payload, so a missing sequence number can block decoding until a key frame.
Example: Send frame 10 at sequence 100, skip sequence 101, then send frame 12 at sequence 102. If late sequence 101 belongs to filtered frame 11, it is dropped while its outgoing slot remains missing; the subscriber keeps requesting it instead of decoding subsequent frames.
Recommended fix: Before dropping an out-of-order filtered packet, arrange for a subscriber-visible padding packet to fill its mapped outgoing sequence number. Preserve RTP timestamp and ordering from the translation and check retransmission handling for the filled slot.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
(Claude replying on Raja's behalf.) Right, this is the known gap in the description. A follow-up stacked on this PR fills such slots: when the forwarder drops a late packet that already has an outgoing slot, the downtrack sends a one byte padding only packet with that sequence number and timestamp. That covers this munger's late drops, the VP8 munger's picture ID cache miss, and the video layer selector's late drops. The two should merge together.
| if f.isDDAvailable { | ||
| f.codecMunger = codecmunger.NewVP8DD(f.logger) | ||
| } else { | ||
| f.codecMunger = codecmunger.NewVP8FromOther(f.codecMunger, f.logger) |
There was a problem hiding this comment.
🔴 VP8 picture IDs break across switches
When a DD publisher also sends VP8 picture IDs, VP8DD forwards them unchanged through temporal filtering and spatial switches. Subscribers receive discontinuous picture IDs instead of the translated sequence required for decoding.
Learn more
Negotiating the dependency-descriptor extension does not establish that every VP8 packet uses the one-byte payload descriptor. The buffer still parses the VP8 payload and stores its optional picture ID and TL0PICIDX in processVideoPacket. VP8DD never rewrites either field, while VP8.UpdateAndGet rewrites picture IDs across filtered frames and switches between simulcast feeds. If a publisher sends both DD and an extended VP8 descriptor, these identifiers now retain the publisher's discontinuities on the subscriber stream.
Example: A publisher uses VP8 picture IDs 100, 101, 102 with a DD; frame 101 is filtered. The subscriber sees 100 then 102, whereas the old VP8 munger emits contiguous translated IDs. A simulcast switch can similarly jump to another feed's unrelated picture ID.
Recommended fix: Keep the frame-based DD filtering, but retain picture ID, TL0PICIDX and key-index rewriting when the incoming VP8 payload descriptor actually contains those fields. Account for a transition between minimized and extended headers and source-switch offsets.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
(Claude replying on Raja's behalf.) Right in principle. libwebrtc minimizes the VP8 payload descriptor whenever it sends the dependency descriptor, and the Go SDK sends picture IDs without the descriptor, so no current sender sends both. A sender that did would lose picture ID rewriting, so 78a7e45 switches to the VP8 munger when a packet with the descriptor carries a picture ID, and keeps switching temporal layers with the dependency descriptor.
…criptor VP8DD needs the one byte VP8 payload descriptor that libwebrtc sends with the dependency descriptor. If a publisher keeps picture IDs next to the descriptor, they need rewriting, so the forwarder switches to the VP8 munger and keeps switching temporal layers with the descriptor. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| f.codecMunger = codecmunger.NewVP8FromOther(f.codecMunger, f.logger) | ||
| if f.started { | ||
| f.codecMunger.SetLast(extPkt) | ||
| } |
There was a problem hiding this comment.
🔴 Intermittent picture IDs break temporal filtering
If a publisher stops sending picture IDs, codecMunger remains a VP8 munger despite receiving dependency descriptors. Its gap exemption then treats every ID-less frame as picture zero, forwarding excluded temporal layers indefinitely.
Learn more
The VP8 payload descriptor's picture ID is optional. This branch permanently replaces the frame-number-based munger after the first packet carrying one, even if later packets retain the dependency descriptor but omit picture IDs. In UpdateAndGet, packets without an ID have picture ID zero. A sequence gap on a filtered layer adds that ID to the exemption cache; subsequent filtered frames with no ID use the same exemption and pass through.
Example: A sender supplies picture ID 10 on frame 10, then sends frames 11 onward with dependency descriptors but no picture IDs. A sequence gap precedes an excluded TL2 frame. The VP8 munger exempts picture zero and forwards that frame and later TL2 frames to a TL0 subscriber.
Recommended fix: Keep descriptor-frame filtering independent of VP8 picture-ID rewriting, or restore the frame-number munger when picture IDs disappear while DD remains present. Preserve outgoing picture-ID continuity across changes in header format.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
(Claude replying on Raja's behalf.) This needs two unusual steps: a sender that puts picture IDs next to the dependency descriptor, which no current SDK does, and then that sender dropping them mid stream. RFC 7741 treats the picture ID as a property of the stream, so the guard makes a one-time choice. A sender that toggles picture IDs is outside what the VP8 munger handles, with or without the descriptor. A non-DD sender that toggles them hits the same picture ID 0 exemption today. The frame number munger covers the real case, libwebrtc's minimized header.
…9 ➔ v1.13.10) (#2338) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [docker.io/livekit/livekit-server](https://github.com/livekit/livekit) | patch | `v1.13.9` → `v1.13.10` | --- ### Release Notes <details> <summary>livekit/livekit (docker.io/livekit/livekit-server)</summary> ### [`v1.13.10`](https://github.com/livekit/livekit/releases/tag/v1.13.10) [Compare Source](livekit/livekit@v1.13.9...v1.13.10) ##### Changed - sfu: forward the dependency descriptor for VP8 simulcast ([#​4987](livekit/livekit#4987)) - sfu: keep VP8 descriptor frame numbers across migration ([#​4989](livekit/livekit#4989)) - sfu: filter VP9 and AV1 simulcast temporal layers with the dependency descriptor ([#​4991](livekit/livekit#4991)) - sfu: filter VP8 temporal layers by frame when the dependency descriptor is sent ([#​4976](livekit/livekit#4976)) - sfu: switch VP8 temporal layers up with the dependency descriptor ([#​4974](livekit/livekit#4974)) - sfu: pad the slot of a filtered packet that follows a sequence number gap ([#​4983](livekit/livekit#4983)) - sfu: send padding in the slot of a dropped out-of-order packet ([#​4979](livekit/livekit#4979)) - sfu: parse VP8 and VP9 payload descriptors without an allocation ([#​4981](livekit/livekit#4981)) - DownTrack: arm key frame requester timer only while a layer lock is pending ([#​4980](livekit/livekit#4980)) - turn: refuse TCP relays and limit relays to this host to media ports ([#​4992](livekit/livekit#4992)) - agent endpoints: address an unnamed deployment as "\_" ([#​4997](livekit/livekit#4997)) - Add OSS Scanner build image and threat model ([#​4995](livekit/livekit#4995)) - Update golang Docker tag to v1.27.1 ([#​4985](livekit/livekit#4985)) - Update alpine Docker tag to v3.24.2 ([#​4984](livekit/livekit#4984)) - Update module github.com/maxbrunsfeld/counterfeiter/v6 to v6.13.0 ([#​4915](livekit/livekit#4915)) ##### Fixed - Send NACKs when processing RTX packets ([#​5000](livekit/livekit#5000)) - sfu: send padding-only packets with no payload ([#​4993](livekit/livekit#4993)) - rtc: release timed out pending tracks at the pending track limit ([#​4998](livekit/livekit#4998)) - Fix nil pointer dereference in IOInfoService.UpdateIngressState ([#​4806](livekit/livekit#4806)) - rtc: keep update cache eviction order when listing recent disconnects ([#​4975](livekit/livekit#4975)) - fix(cli): return non-zero exit status on command errors ([#​4888](livekit/livekit#4888)) - Disable AV1 for Firefox clients before 157 ([#​4962](livekit/livekit#4962)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNTEuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjE1MS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/2338
…v1.13.10) (#884) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [docker.io/livekit/livekit-server](https://github.com/livekit/livekit) | patch | `v1.13.9` → `v1.13.10` | --- ### Release Notes <details> <summary>livekit/livekit (docker.io/livekit/livekit-server)</summary> ### [`v1.13.10`](https://github.com/livekit/livekit/releases/tag/v1.13.10) [Compare Source](livekit/livekit@v1.13.9...v1.13.10) ##### Changed - sfu: forward the dependency descriptor for VP8 simulcast ([#​4987](livekit/livekit#4987)) - sfu: keep VP8 descriptor frame numbers across migration ([#​4989](livekit/livekit#4989)) - sfu: filter VP9 and AV1 simulcast temporal layers with the dependency descriptor ([#​4991](livekit/livekit#4991)) - sfu: filter VP8 temporal layers by frame when the dependency descriptor is sent ([#​4976](livekit/livekit#4976)) - sfu: switch VP8 temporal layers up with the dependency descriptor ([#​4974](livekit/livekit#4974)) - sfu: pad the slot of a filtered packet that follows a sequence number gap ([#​4983](livekit/livekit#4983)) - sfu: send padding in the slot of a dropped out-of-order packet ([#​4979](livekit/livekit#4979)) - sfu: parse VP8 and VP9 payload descriptors without an allocation ([#​4981](livekit/livekit#4981)) - DownTrack: arm key frame requester timer only while a layer lock is pending ([#​4980](livekit/livekit#4980)) - turn: refuse TCP relays and limit relays to this host to media ports ([#​4992](livekit/livekit#4992)) - agent endpoints: address an unnamed deployment as "\_" ([#​4997](livekit/livekit#4997)) - Add OSS Scanner build image and threat model ([#​4995](livekit/livekit#4995)) - Update golang Docker tag to v1.27.1 ([#​4985](livekit/livekit#4985)) - Update alpine Docker tag to v3.24.2 ([#​4984](livekit/livekit#4984)) - Update module github.com/maxbrunsfeld/counterfeiter/v6 to v6.13.0 ([#​4915](livekit/livekit#4915)) ##### Fixed - Send NACKs when processing RTX packets ([#​5000](livekit/livekit#5000)) - sfu: send padding-only packets with no payload ([#​4993](livekit/livekit#4993)) - rtc: release timed out pending tracks at the pending track limit ([#​4998](livekit/livekit#4998)) - Fix nil pointer dereference in IOInfoService.UpdateIngressState ([#​4806](livekit/livekit#4806)) - rtc: keep update cache eviction order when listing recent disconnects ([#​4975](livekit/livekit#4975)) - fix(cli): return non-zero exit status on command errors ([#​4888](livekit/livekit#4888)) - Disable AV1 for Firefox clients before 157 ([#​4962](livekit/livekit#4962)) </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/London) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNjcuNSIsInVwZGF0ZWRJblZlciI6IjQ0LjE2Ny41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.hayden.moe/hayden/phoebe/pulls/884
Follows #4974 (#4973).
Problem
With the dependency descriptor, libwebrtc sends a one byte VP8 payload descriptor: no picture ID. The VP8 munger has nothing to rewrite, but its temporal drop logic keys on the picture ID, which is now always 0.
Fix
New
codecmunger.VP8DDfor dependency descriptor streams:leaves the header unchanged
decides once per frame, from the descriptor's frame number and temporal ID
applies that decision to every packet of the frame, late ones included (64-frame window)
needs no gap exemption
Wiring: the forwarder picks it for a negotiated extension.
Fallback: the existing fallback puts the
VP8munger back. After start, it seeds that munger withSetLast.Tests
codecmunger/vp8dd_test.go: layer filter, gap, late packets after a layer change, window, layer switch, paddingTestForwarderVP8DDTemporalFilterAfterGap: gap then contiguous frames throughGetTranslationParams. Fails without this change.🤖 Generated with Claude Code