Skip to content

sfu: pad the slot of a filtered packet that follows a sequence number gap - #4983

Merged
boks1971 merged 1 commit into
masterfrom
raja/pad-filtered-gap-slot
Oct 11, 2026
Merged

boks1971 merged 1 commit into
masterfrom
raja/pad-filtered-gap-slot

Conversation

@boks1971

Copy link
Copy Markdown
Contributor

Problem

When a packet is filtered right after a gap, the forwarder can leave the subscriber with a sequence number hole that is never filled. A VP8 subscriber with the dependency descriptor stalls on that hole until it gets a key frame.

Example: VP8 with the dependency descriptor, subscriber on TL0

Step What happens
1 Packet 10 is forwarded as outgoing 10.
2 Packet 11 is lost on the publisher's uplink.
3 Packet 12 arrives after the gap. It is on a filtered temporal layer. The munger gives it slot 12.
4 The VP8 DD munger returns ErrFilteredVP8TemporalLayer. translateCodecHeader calls PacketDropped, which rolls the last outgoing number back to 10.
5 The retransmission of 11 arrives. Its slot is 11, which is not below the last outgoing number 10. UpdateAndGetSnTs rejects it with "unexpected packet ordering".
6 Outgoing 11 is never sent. The subscriber NACKs it, the SFU cannot answer, and the stream stalls until a key frame.

A test with Chrome and 10% uplink loss showed this. With temporal filtering at 15 and 8 fps, the subscriber got 1.3 and 0.4 fps, with 15 and 16 PLIs in one minute each. Without filtering, it got 9.8 fps with 4 PLIs in 30 seconds. The server logged "unexpected packet ordering" 189 times in 3 minutes.

The old VP8 munger does not hit this. After a gap it forwards the packet whatever its layer. The VP8 DD munger from #4976 is the first munger that drops a packet after a gap.

The layer selector drop path has a related hole. A relevant packet that the selector drops after a gap keeps its slot, but nothing is sent in it.

Change

  • A filtered packet after a gap keeps its slot and gets padding in it, like a filtered out-of-order packet (sfu: send padding in the slot of a dropped out-of-order packet #4979).
  • PacketDropped runs only for a contiguous packet. After a gap, its rollback moves the last outgoing number below the missing packets' slots, so their late copies are rejected as in step 5.
  • This applies to both drop paths: the codec munger (translateCodecHeader) and the layer selector (getTranslationParamsVideo).
  • The padding reports its real ordering to the sender stats. A gap slot is the newest packet, not an out-of-order one.
  • The cost is one padding packet for each filtered packet that follows a gap. At 10% loss on a filtered layer, that is a few packets per second.

Test

TestForwarderPadFilteredSlotAfterGap: packet 10, then 11 is lost, then filtered packet 12, then the late 11, then 13. It expects padding in slot 12, the late 11 in slot 11 and 13 in slot 13. It runs once with the codec munger dropping 12 and once with the layer selector dropping it. Each case fails without its half of the fix.

🤖 Generated with Claude Code

… gap

A filtered packet that follows a sequence number gap now keeps its slot
and gets padding in it. Rolling it back moved the last outgoing number
below the missing packets' slots, so their retransmissions were rejected
and the subscriber stalled on the hole until a key frame.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@boks1971
boks1971 merged commit b1c801b into master Oct 11, 2026
6 checks passed
@boks1971
boks1971 deleted the raja/pad-filtered-gap-slot branch October 11, 2026 17:33
eleboucher pushed a commit to eleboucher/homelab that referenced this pull request Oct 14, 2026
…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 ([#&#8203;4987](livekit/livekit#4987))
- sfu: keep VP8 descriptor frame numbers across migration ([#&#8203;4989](livekit/livekit#4989))
- sfu: filter VP9 and AV1 simulcast temporal layers with the dependency descriptor ([#&#8203;4991](livekit/livekit#4991))
- sfu: filter VP8 temporal layers by frame when the dependency descriptor is sent ([#&#8203;4976](livekit/livekit#4976))
- sfu: switch VP8 temporal layers up with the dependency descriptor ([#&#8203;4974](livekit/livekit#4974))
- sfu: pad the slot of a filtered packet that follows a sequence number gap ([#&#8203;4983](livekit/livekit#4983))
- sfu: send padding in the slot of a dropped out-of-order packet ([#&#8203;4979](livekit/livekit#4979))
- sfu: parse VP8 and VP9 payload descriptors without an allocation ([#&#8203;4981](livekit/livekit#4981))
- DownTrack: arm key frame requester timer only while a layer lock is pending ([#&#8203;4980](livekit/livekit#4980))
- turn: refuse TCP relays and limit relays to this host to media ports ([#&#8203;4992](livekit/livekit#4992))
- agent endpoints: address an unnamed deployment as "\_" ([#&#8203;4997](livekit/livekit#4997))
- Add OSS Scanner build image and threat model ([#&#8203;4995](livekit/livekit#4995))
- Update golang Docker tag to v1.27.1 ([#&#8203;4985](livekit/livekit#4985))
- Update alpine Docker tag to v3.24.2 ([#&#8203;4984](livekit/livekit#4984))
- Update module github.com/maxbrunsfeld/counterfeiter/v6 to v6.13.0 ([#&#8203;4915](livekit/livekit#4915))

##### Fixed

- Send NACKs when processing RTX packets ([#&#8203;5000](livekit/livekit#5000))
- sfu: send padding-only packets with no payload ([#&#8203;4993](livekit/livekit#4993))
- rtc: release timed out pending tracks at the pending track limit ([#&#8203;4998](livekit/livekit#4998))
- Fix nil pointer dereference in IOInfoService.UpdateIngressState ([#&#8203;4806](livekit/livekit#4806))
- rtc: keep update cache eviction order when listing recent disconnects ([#&#8203;4975](livekit/livekit#4975))
- fix(cli): return non-zero exit status on command errors ([#&#8203;4888](livekit/livekit#4888))
- Disable AV1 for Firefox clients before 157 ([#&#8203;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
hbjydev pushed a commit to hbjydev/phoebe that referenced this pull request Oct 20, 2026
…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 ([#&#8203;4987](livekit/livekit#4987))
- sfu: keep VP8 descriptor frame numbers across migration ([#&#8203;4989](livekit/livekit#4989))
- sfu: filter VP9 and AV1 simulcast temporal layers with the dependency descriptor ([#&#8203;4991](livekit/livekit#4991))
- sfu: filter VP8 temporal layers by frame when the dependency descriptor is sent ([#&#8203;4976](livekit/livekit#4976))
- sfu: switch VP8 temporal layers up with the dependency descriptor ([#&#8203;4974](livekit/livekit#4974))
- sfu: pad the slot of a filtered packet that follows a sequence number gap ([#&#8203;4983](livekit/livekit#4983))
- sfu: send padding in the slot of a dropped out-of-order packet ([#&#8203;4979](livekit/livekit#4979))
- sfu: parse VP8 and VP9 payload descriptors without an allocation ([#&#8203;4981](livekit/livekit#4981))
- DownTrack: arm key frame requester timer only while a layer lock is pending ([#&#8203;4980](livekit/livekit#4980))
- turn: refuse TCP relays and limit relays to this host to media ports ([#&#8203;4992](livekit/livekit#4992))
- agent endpoints: address an unnamed deployment as "\_" ([#&#8203;4997](livekit/livekit#4997))
- Add OSS Scanner build image and threat model ([#&#8203;4995](livekit/livekit#4995))
- Update golang Docker tag to v1.27.1 ([#&#8203;4985](livekit/livekit#4985))
- Update alpine Docker tag to v3.24.2 ([#&#8203;4984](livekit/livekit#4984))
- Update module github.com/maxbrunsfeld/counterfeiter/v6 to v6.13.0 ([#&#8203;4915](livekit/livekit#4915))

##### Fixed

- Send NACKs when processing RTX packets ([#&#8203;5000](livekit/livekit#5000))
- sfu: send padding-only packets with no payload ([#&#8203;4993](livekit/livekit#4993))
- rtc: release timed out pending tracks at the pending track limit ([#&#8203;4998](livekit/livekit#4998))
- Fix nil pointer dereference in IOInfoService.UpdateIngressState ([#&#8203;4806](livekit/livekit#4806))
- rtc: keep update cache eviction order when listing recent disconnects ([#&#8203;4975](livekit/livekit#4975))
- fix(cli): return non-zero exit status on command errors ([#&#8203;4888](livekit/livekit#4888))
- Disable AV1 for Firefox clients before 157 ([#&#8203;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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants