Fix receiver load balance threshold initialization - #4678
Merged
boks1971 merged 1 commit intoJul 16, 2026
Conversation
boks1971
approved these changes
Jul 16, 2026
boks1971
left a comment
Contributor
There was a problem hiding this comment.
Thank you so much for catching this. Great catch!
Just some small comments,
- I think the test file can be removed. It is simple enough.
- Can you please add it to
redreceiver.goandredprimaryreceiver.goalso? I can take care of it if you would rather leave this at this point. Basically, do something like- Add method to
REDTransformerinterface inreceiver_base.go - In
SetLBThreshold, doloadREDTransformerand if not nil, call the method added toREDTransformerinterface. - Implement the method in those two RED files and pass it on to the spreader they have.
- Add method to
| @@ -0,0 +1,42 @@ | |||
| // Copyright 2026 LiveKit, Inc. | |||
Contributor
There was a problem hiding this comment.
this test can be removed. It is simple enough.
Contributor
|
I will merge this now and do the changes I suggested. Thank you once again for catching this. |
boks1971
added a commit
that referenced
this pull request
Jul 16, 2026
Following up on this PR (#4678 - great catch btw, thank you), propagating the spreader threshold to RED receivers also. Removing the test as it was a simple case and that would not have caught the original issue.
eleboucher
pushed a commit
to eleboucher/homelab
that referenced
this pull request
Jul 18, 2026
…3 ➔ v1.13.4) (#1641) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [docker.io/livekit/livekit-server](https://github.com/livekit/livekit) | patch | `v1.13.3` → `v1.13.4` | --- ### Release Notes <details> <summary>livekit/livekit (docker.io/livekit/livekit-server)</summary> ### [`v1.13.4`](https://github.com/livekit/livekit/releases/tag/v1.13.4) [Compare Source](livekit/livekit@v1.13.3...v1.13.4) ##### Added - added mocking function for SIP dialing methods ([#​4642](livekit/livekit#4642)) - Add signal tests to test-server ([#​4653](livekit/livekit#4653)) - Add option to exclude local IPv6 candidates. ([#​4657](livekit/livekit#4657)) - Add a method to get forward stats via API method. ([#​4664](livekit/livekit#4664)) - Add drop-on-close signal test scenario ([#​4669](livekit/livekit#4669)) - Log soft validation errors. ([#​4671](livekit/livekit#4671)) - add redaction flag in Job ([#​4650](livekit/livekit#4650)) ##### Changed - simpler mock protocol ([#​4641](livekit/livekit#4641)) - Make IsConnectionCanceled available at LocalParticipant interface. ([#​4643](livekit/livekit#4643)) - Update actions/checkout action to v7 ([#​4646](livekit/livekit#4646)) - Update protocol. ([#​4648](livekit/livekit#4648)) - Export migration to LocalParticipant interface. ([#​4652](livekit/livekit#4652)) - Record final RTC state as success/failure. ([#​4658](livekit/livekit#4658)) - Omit rtx/out-of-order packets from forwarding delay measurement. ([#​4659](livekit/livekit#4659)) - Move ForwardStats aggregation off the packet forwarding path ([#​4660](livekit/livekit#4660)) - protocol deps to get parallel exec alloc reduction ([#​4662](livekit/livekit#4662)) - Update pion/ice to deal with hang on close. ([#​4672](livekit/livekit#4672)) - Add more details to unreliable data channel drop error. ([#​4673](livekit/livekit#4673)) - Record `rtc_success` prom as soon as RTC connects. ([#​4677](livekit/livekit#4677)) - Use proto logger to get named enums in the logs. ([#​4679](livekit/livekit#4679)) - Propagate spreader threshold to RED receivers. ([#​4683](livekit/livekit#4683)) - Prefer QDisc.Stats till go-tc addresses QDisc.Stats2 parsing ([#​4685](livekit/livekit#4685)) - Bump protocol version to fix call to Validate. ([#​4686](livekit/livekit#4686)) ##### Fixed - bound data-track buffering under downlink congestion (targetLatency) ([#​4667](livekit/livekit#4667)) - Guard against nil TC qdisc stats to prevent SIGSEGV ([#​4668](livekit/livekit#4668)) - Fix goroutine leak from orphaned signal relay streams ([#​4674](livekit/livekit#4674)) - don't undercount data channel bitrate over idle gaps ([#​4676](livekit/livekit#4676)) - Fix receiver load balance threshold initialization ([#​4678](livekit/livekit#4678)) - rtc: guard against nil subscriber in TransportManager.HandleAnswer ([#​4680](livekit/livekit#4680)) - Potential fix for code scanning alert no. 42: Incorrect conversion between integer types ([#​4684](livekit/livekit#4684)) </details> --- ### Configuration 📅 **Schedule**: 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 [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/1641
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
NewReceiverBasecreates theDownTrackSpreaderbefore receiver optionsare applied.
The spreader is therefore initialized with the default
lbThresholdofzero.
WithLoadBalanceThreshold(20)is applied afterward, butSetLBThresholdpreviously updated only theReceiverBasefield and notthe already-created spreader.
A zero spreader threshold is treated as 1,000,000, effectively disabling
parallel DownTrack writes for large rooms. This can cause forwarding
latency and packet queue buildup with large subscriber counts, especially
for single-layer screen share tracks.
Fix
SetLBThresholdupdates to the activeDownTrackSpreader.Testing
go test ./pkg/sfu ./pkg/sfu/utils ./pkg/rtc -count=1go test -race ./pkg/sfu ./pkg/sfu/utils -count=1