Repository navigation
Conversation
The SFU answers publisher offers without the simulcast pause markers (SetIgnoreRidPauseForRecv), so applying the answer re-enables in the browser the layers that dynacast had paused. Dynacast only notifies changes, so those layers stayed on until the subscribed quality of the track changed again. Send the publisher its committed subscribed qualities again 1 s after each answer, once the client has applied it: livekit-client handles the next signal message without waiting for the answer to be applied. Fixes livekit#4906
There was a problem hiding this comment.
Devin Review found 2 potential issues.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| if len(d.committedMaxSubscribedQuality) != 0 { | ||
| d.enqueueSubscribedQualityChange() | ||
| } |
There was a problem hiding this comment.
🔴 Resend deadline leaves layers enabled
When an answer arrives near the eight-second deadline, dynacastResendTimer fires before the publisher applies it. The publisher ignores the premature pause, then re-enables those layers without another resend.
Learn more
A publisher answer restarts the timer, but its duration is capped by a deadline set for the first answer in the burst. After six seconds of repeated answers, the cap leaves less than the two-second application delay. An answer close to or after the deadline triggers a resend almost immediately. The client can process that update before applying the answer, so the pause request has no effect; the answer subsequently re-enables the layers. Without another answer or quality change, they stay enabled.
Example: Answers arrive at 0, 4, and 7.999 seconds. The last answer resets the resend timer to about 1 ms, not 2 seconds. If the client applies that answer after the update, the layers remain enabled.
Recommended fix: Keep the bounded burst resend if needed, but also guarantee a resend at least publisherAnswerDynacastResendDelay after the last answer. Track the last-answer time or schedule a separate trailing timer, and avoid treating an early deadline callback as the final resend.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
On a resume, ICERestart() → Restart() clears the committed qualities and the initialQualityUpdateWait timer re-sends them after 10 s, so this PR's resend is a no-op there. That behaviour predates the PR: measured with a real resume, the layers come back and are paused again ~10 s later with and without this change. The case this PR fixes is renegotiation without a dynacast restart (publishing/unpublishing a track, codec changes, ICE restart without resume), where the layers otherwise stay on indefinitely. Re-sending during the post-restart window would mean trusting the pre-resume state, which the timer deliberately avoids, so I'd keep it out of scope.
| if len(d.committedMaxSubscribedQuality) != 0 { | ||
| d.enqueueSubscribedQualityChange() | ||
| } |
There was a problem hiding this comment.
🟡 Renegotiation duplicates quality analytics events
Each ResendCommittedQuality notification reaches onSubscribedMaxQualityChange, which records quality analytics without checking for changes. Every publisher answer therefore creates duplicate quality events for unchanged tracks.
Learn more
The video manager uses the same listener for real quality changes and post-answer resends. The listener calls onSubscribedMaxQualityChange, which emits an analytics event for each codec before sending the publisher its quality update. A resend leaves the committed quality unchanged, but it still produces another analytics event. Repeated renegotiations inflate quality-change event counts.
Example: A track stays at LOW through three offers. The post-answer callbacks send three more LOW analytics events even though its subscribed quality never changed.
Recommended fix: Distinguish resends from committed changes at the listener boundary, and skip OnTrackMaxSubscribedVideoQuality for a resend while still sending the signalling update.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Each resend emits one more OnTrackMaxSubscribedVideoQuality event with an unchanged quality, but that is the already existing behavior on forced updates (unmute, post-restart timer).
boks1971
left a comment
There was a problem hiding this comment.
Thank you for fixing this @pabloFuente . Somehow you catch all the edge cases :-) Really appreciate it.
Left one small comment. Let me know what you think. Can merge this once you let me know what you think.
| sdBatchSize = 30 | ||
| rttUpdateInterval = 5 * time.Second | ||
|
|
||
| publisherAnswerDynacastResendDelay = time.Second |
There was a problem hiding this comment.
can we increase this @pabloFuente ? Does 5s sound okay to you? I am concerned about edge cases racing. It is not catastrophic in the sense it probably wastes bandwidth, but does not reduce quality. Thought it would be good to have enough gap here to reduce a probability of a misfire to a small value.
There was a problem hiding this comment.
Actually, thought of a couple of more bits.
- In single peer connection mode, there may be a bunch of answers if there are a lot of subscribe/unsubscribe. So that could add up.
- If we debounce for 5s after an answer (and potentially cancel pending ones, i. e. wait for 5s after last answer), that could mean it is not sent if there are too many answers and that window keeps extending. That could thrash a lot on client side too.
Need to think more about this.
The SDP way is not consistent across browsers/clients IIRC. That's why preferred using signalling, but layer control is browsers itself is a bit iffy. Maybe, we can start with what you have and keep thinking more about it for any better options.
There was a problem hiding this comment.
Without a doubt, SPC mode causes both the bug and the proposed solution to occur more frequently. With separate PeerConnections for published and subscribed tracks, the publisher only needed to renegotiate the SDP in response to its own changes (publishing or unpublishing a track, a codec change, an ICE restart...), which we can consider "rare". But in SPC mode, renegotiations on subscribed tracks inevitably involve the publisher client resending a new offer that includes the published simulcast tracks, which ends with livekit-server re-enabling the paused layers.
After giving this some quick thought, I think there are two main issues here:
- As you implied it is possible (especially with SCP) that lots of "resend quality" operations accumulate for a single simulcast participant in a short period of time. When multiple events happen in a Room simultaneously (participants connecting/leaving, publishing/unpublishing...), that translates into bursts of "resend quality" requests to affected participants. It is also true that they seem cheap on the client side (I only checked client-sdk-js), as it only calls
setParameterswhen an encoding'sactiveflag actually changes. But the signalling and analytics traffic grows with the Room's activity. - The delay is a trade-off in both directions, and SPC makes it matter more:
- If it is too short, then the resend may be handled by the client before applying the new answer, and the layers remain unpaused. The answer and the resend travel over the same WS in order, so the danger is in the client handling both events asynchronosuly. Theoretically, a very slow client could take longer than 1 second to apply the answer and could end up overwriting the resend.
- If it is too long, and especially with SPC in Rooms with constant activity, it could mean the publisher's dynacast almost never pauses the unused layers.
So, to minimize these issues, we can improve my PR with two simple additions:
- Handle the bursts per participant with a simple resend timer: instead of a timer per resend, keep a single pending timer per participant. Each answer pushes back the resend a fixed time (2s, doubling the 1s margin we had before), for a maximum of N seconds (8s, for example). This allows "combining" multiple resend operations into a single one, effectively reducing the number of messages and analytics.
- Skip tracks with nothing paused: if all simulcast layers are active (HIGH quality is comitted), then an answer cannot re-enable anything. We can save all extra message and analytic events for those publishers.
There was a problem hiding this comment.
Sounds good to me. Thank you. Reading the latest.
There was a problem hiding this comment.
One last thing: while this is an effective solution, it is in the end just a good quality mitigation, and the real solution belongs on the client side. It is the one whose layer state gets overwritten, and it is the only side that knows the precise moment when that happens. It should simply remember the last SubscribedQualityUpdate received for its tracks, and re-apply it right after applying every answer on its PeerConnection. This removes the need of timers, guesses and extra signalling, and not a single extra byte of wasted upload bandwidth would be sent.
In the client-sdk-js it is as easy as calling these lines for each published video track when receiving publisher answers.
But... adding that logic to every single client SDK is too big a task for me.
There was a problem hiding this comment.
Agreed. I will socialise this with client team.
… layers In SPC, every subscription change of a participant goes through a new publisher offer and answer, so answers come in bursts when a room is busy. Each answer scheduled its own resend of the subscribed qualities, sending the same update several times in a row. Thist change keeps one pending resend per participant instead. It fires 2 s after the last answer, and never later than 8 s after the first answer of the burst, so a steady stream of answers cannot postpone it forever. It also skips the resend for tracks whose committed qualities are all HIGH: with every layer enabled, an answer has nothing paused to re-enable. We can save those messages.
boks1971
left a comment
There was a problem hiding this comment.
LGTM! Thank you for doing this.
…7 ➔ v1.13.8) (#2275) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [docker.io/livekit/livekit-server](https://github.com/livekit/livekit) | patch | `v1.13.7` → `v1.13.8` | --- ### Release Notes <details> <summary>livekit/livekit (docker.io/livekit/livekit-server)</summary> ### [`v1.13.8`](https://github.com/livekit/livekit/releases/tag/v1.13.8) [Compare Source](livekit/livekit@v1.13.7...v1.13.8) ##### Added - agent: HTTP endpoints data plane ([#​4779](livekit/livekit#4779)) - use sender report pass through setting to forward abs-capture-time verbatim ([#​4812](livekit/livekit#4812)) - Add sdk lable to session start time and participant join ([#​4885](livekit/livekit#4885)) - Add a local participant method to get recently disconnected ([#​4911](livekit/livekit#4911)) - service: start room composite egress configured in a room preset ([#​4926](livekit/livekit#4926)) ##### Changed - Update github workflows ([#​4446](livekit/livekit#4446)) - Reduce descriptor marshal allocations on Go 1.26.4/linux-amd64 ([#​4681](livekit/livekit#4681)) - config: reject unknown send\_side\_bwe\_pacer, warn on unwired fallback ([#​4804](livekit/livekit#4804)) - Update github.com/livekit/protocol digest to [`a879e94`](livekit/livekit@a879e94) ([#​4864](livekit/livekit#4864)) - Update module github.com/gotesttools/gotestfmt/v2 to v2.5.0 ([#​4865](livekit/livekit#4865)) - Update module github.com/urfave/cli/v3 to v3.11.0 ([#​4867](livekit/livekit#4867)) - Update module golang.org/x/mod to v0.41.0 ([#​4868](livekit/livekit#4868)) - sfu: return VP8 munged header by value to avoid per-packet allocation ([#​4871](livekit/livekit#4871)) - sfu: patch pacer header extensions without per-packet allocation ([#​4872](livekit/livekit#4872)) - Update pion/sdp to get lesser SDP retention ([#​4873](livekit/livekit#4873)) - sfu: skip pacer allocation assertion under the race detector ([#​4874](livekit/livekit#4874)) - sfu: broadcast RTP to down tracks without per-packet allocations ([#​4875](livekit/livekit#4875)) - Track action versions and stop quarantining our own actions ([#​4877](livekit/livekit#4877)) - test: fix two data races in the test suites ([#​4878](livekit/livekit#4878)) - Bump go.opentelemetry.io/otel/sdk ([#​4879](livekit/livekit#4879)) - deps: update psrpc to v0.8.0 ([#​4882](livekit/livekit#4882)) - Update module github.com/moby/moby/client to v0.6.0 ([#​4883](livekit/livekit#4883)) - Update module golang.org/x/sync to v0.23.0 ([#​4884](livekit/livekit#4884)) - Propagate SIP\_TRUNK\_FAILURE ([#​4890](livekit/livekit#4890)) - ccutils: use millisecond resolution for probe interval backoff ([#​4891](livekit/livekit#4891)) - Increase receiver loadbalance threshold when batch io enabled ([#​4899](livekit/livekit#4899)) - rtc: parse each remote offer once per negotiation ([#​4904](livekit/livekit#4904)) - Bump protocol ([#​4909](livekit/livekit#4909)) - rtc: split EndSession out of MoveToRoom ([#​4917](livekit/livekit#4917)) - telemetry: drop the stats worker re-key path ([#​4918](livekit/livekit#4918)) - sfu: report forwarding latency as p90 instead of the mean ([#​4920](livekit/livekit#4920)) - rtc: accept ICE Completed in ICE-restart connect assertions ([#​4921](livekit/livekit#4921)) - rtc: measure data blob keys by their content, not their text form ([#​4923](livekit/livekit#4923)) - Remove deprecatred way of setting prometheus from the config file ([#​4928](livekit/livekit#4928)) - test: give mock participants a connection quality, close test rooms ([#​4933](livekit/livekit#4933)) - update warp dep ([#​4943](livekit/livekit#4943)) ##### Fixed - Do not add down tracks after receiver close ([#​4857](livekit/livekit#4857)) - Do not request media sections for transceivers that cannot send ([#​4892](livekit/livekit#4892)) - Deregister agent job when the server terminates it ([#​4893](livekit/livekit#4893)) - sfu: don't hold bindLock across the blank-frame flush in CloseWithFlush ([#​4895](livekit/livekit#4895)) - dynacast: re-send subscribed qualities after every publisher answer ([#​4907](livekit/livekit#4907)) - agent: release JobTerminate handler when job ends before registration ([#​4908](livekit/livekit#4908)) - Report disconnected for older disconnected participants. ([#​4910](livekit/livekit#4910)) - rtc: record a room's departure when the participant leaves it ([#​4913](livekit/livekit#4913)) - update deps to fix warp issue ([#​4916](livekit/livekit#4916)) - sfu: fix data stats active window bitrate and duration units ([#​4922](livekit/livekit#4922)) - fix: reject instead of drop for no dispatch rule ([#​4927](livekit/livekit#4927)) - fix: skip RTX/FEC when picking a fallback video codec ([#​4930](livekit/livekit#4930)) - fix: do not read invalid delta ([#​4935](livekit/livekit#4935)) - fix: use the fast debounce for the first negotiation ([#​4936](livekit/livekit#4936)) - fix: skip DTLS HelloVerifyRequest ([#​4937](livekit/livekit#4937)) - config: parse generated duration flags as durations ([#​4939](livekit/livekit#4939)) - fix: use the most common recent packet rate in connection quality ([#​4940](livekit/livekit#4940)) - fix: copy RED history packets instead of keeping pointers ([#​4941](livekit/livekit#4941)) - fix: keep one subscription when first subscribes race ([#​4944](livekit/livekit#4944)) - bump protocol to get unlock on no key fix ([#​4945](livekit/livekit#4945)) - fix: count leftover upstream loss after RTX repairs ([#​4946](livekit/livekit#4946)) - fix: switch VP8 temporal layer up only at a layer sync frame ([#​4947](livekit/livekit#4947)) - fix: reconcile everything when the reconcile queue overflows ([#​4948](livekit/livekit#4948)) - fix: enable H.264 publish for desktop Linux Firefox ([#​4949](livekit/livekit#4949)) </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:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjEzMy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/2275
…7 → v1.13.9) (#854) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [docker.io/livekit/livekit-server](https://github.com/livekit/livekit) | patch | `v1.13.7` → `v1.13.9` | --- ### Release Notes <details> <summary>livekit/livekit (docker.io/livekit/livekit-server)</summary> ### [`v1.13.9`](https://github.com/livekit/livekit/releases/tag/v1.13.9) [Compare Source](livekit/livekit@v1.13.8...v1.13.9) Please note that release v1.13.8 introduced a behaviour change that caused egress start failures explained in [#​4955](livekit/livekit#4955). This release restores the behaviour to what it was in v1.13.7 and before. ##### Changed - bump protocol and psrpc deps ([#​4958](livekit/livekit#4958)) - sfu/buffer: parse the dependency descriptor without allocating ([#​4953](livekit/livekit#4953)) - sfu/buffer: stop allocating per ingested packet ([#​4951](livekit/livekit#4951)) ##### Fixed - v1 path: check for subscriber_allow_pause presence before using it ([#​4957](livekit/livekit#4957)) - Cap forward-jump loops in SelectorDecisionCache ([#​4952](livekit/livekit#4952)) ### [`v1.13.8`](https://github.com/livekit/livekit/releases/tag/v1.13.8) [Compare Source](livekit/livekit@v1.13.7...v1.13.8) ##### Added - agent: HTTP endpoints data plane ([#​4779](livekit/livekit#4779)) - use sender report pass through setting to forward abs-capture-time verbatim ([#​4812](livekit/livekit#4812)) - Add sdk lable to session start time and participant join ([#​4885](livekit/livekit#4885)) - Add a local participant method to get recently disconnected ([#​4911](livekit/livekit#4911)) - service: start room composite egress configured in a room preset ([#​4926](livekit/livekit#4926)) ##### Changed - Update github workflows ([#​4446](livekit/livekit#4446)) - Reduce descriptor marshal allocations on Go 1.26.4/linux-amd64 ([#​4681](livekit/livekit#4681)) - config: reject unknown send_side_bwe_pacer, warn on unwired fallback ([#​4804](livekit/livekit#4804)) - Update github.com/livekit/protocol digest to [`a879e94`](livekit/livekit@a879e94) ([#​4864](livekit/livekit#4864)) - Update module github.com/gotesttools/gotestfmt/v2 to v2.5.0 ([#​4865](livekit/livekit#4865)) - Update module github.com/urfave/cli/v3 to v3.11.0 ([#​4867](livekit/livekit#4867)) - Update module golang.org/x/mod to v0.41.0 ([#​4868](livekit/livekit#4868)) - sfu: return VP8 munged header by value to avoid per-packet allocation ([#​4871](livekit/livekit#4871)) - sfu: patch pacer header extensions without per-packet allocation ([#​4872](livekit/livekit#4872)) - Update pion/sdp to get lesser SDP retention ([#​4873](livekit/livekit#4873)) - sfu: skip pacer allocation assertion under the race detector ([#​4874](livekit/livekit#4874)) - sfu: broadcast RTP to down tracks without per-packet allocations ([#​4875](livekit/livekit#4875)) - Track action versions and stop quarantining our own actions ([#​4877](livekit/livekit#4877)) - test: fix two data races in the test suites ([#​4878](livekit/livekit#4878)) - Bump go.opentelemetry.io/otel/sdk ([#​4879](livekit/livekit#4879)) - deps: update psrpc to v0.8.0 ([#​4882](livekit/livekit#4882)) - Update module github.com/moby/moby/client to v0.6.0 ([#​4883](livekit/livekit#4883)) - Update module golang.org/x/sync to v0.23.0 ([#​4884](livekit/livekit#4884)) - Propagate SIP_TRUNK_FAILURE ([#​4890](livekit/livekit#4890)) - ccutils: use millisecond resolution for probe interval backoff ([#​4891](livekit/livekit#4891)) - Increase receiver loadbalance threshold when batch io enabled ([#​4899](livekit/livekit#4899)) - rtc: parse each remote offer once per negotiation ([#​4904](livekit/livekit#4904)) - Bump protocol ([#​4909](livekit/livekit#4909)) - rtc: split EndSession out of MoveToRoom ([#​4917](livekit/livekit#4917)) - telemetry: drop the stats worker re-key path ([#​4918](livekit/livekit#4918)) - sfu: report forwarding latency as p90 instead of the mean ([#​4920](livekit/livekit#4920)) - rtc: accept ICE Completed in ICE-restart connect assertions ([#​4921](livekit/livekit#4921)) - rtc: measure data blob keys by their content, not their text form ([#​4923](livekit/livekit#4923)) - Remove deprecatred way of setting prometheus from the config file ([#​4928](livekit/livekit#4928)) - test: give mock participants a connection quality, close test rooms ([#​4933](livekit/livekit#4933)) - update warp dep ([#​4943](livekit/livekit#4943)) ##### Fixed - Do not add down tracks after receiver close ([#​4857](livekit/livekit#4857)) - Do not request media sections for transceivers that cannot send ([#​4892](livekit/livekit#4892)) - Deregister agent job when the server terminates it ([#​4893](livekit/livekit#4893)) - sfu: don't hold bindLock across the blank-frame flush in CloseWithFlush ([#​4895](livekit/livekit#4895)) - dynacast: re-send subscribed qualities after every publisher answer ([#​4907](livekit/livekit#4907)) - agent: release JobTerminate handler when job ends before registration ([#​4908](livekit/livekit#4908)) - Report disconnected for older disconnected participants. ([#​4910](livekit/livekit#4910)) - rtc: record a room's departure when the participant leaves it ([#​4913](livekit/livekit#4913)) - update deps to fix warp issue ([#​4916](livekit/livekit#4916)) - sfu: fix data stats active window bitrate and duration units ([#​4922](livekit/livekit#4922)) - fix: reject instead of drop for no dispatch rule ([#​4927](livekit/livekit#4927)) - fix: skip RTX/FEC when picking a fallback video codec ([#​4930](livekit/livekit#4930)) - fix: do not read invalid delta ([#​4935](livekit/livekit#4935)) - fix: use the fast debounce for the first negotiation ([#​4936](livekit/livekit#4936)) - fix: skip DTLS HelloVerifyRequest ([#​4937](livekit/livekit#4937)) - config: parse generated duration flags as durations ([#​4939](livekit/livekit#4939)) - fix: use the most common recent packet rate in connection quality ([#​4940](livekit/livekit#4940)) - fix: copy RED history packets instead of keeping pointers ([#​4941](livekit/livekit#4941)) - fix: keep one subscription when first subscribes race ([#​4944](livekit/livekit#4944)) - bump protocol to get unlock on no key fix ([#​4945](livekit/livekit#4945)) - fix: count leftover upstream loss after RTX repairs ([#​4946](livekit/livekit#4946)) - fix: switch VP8 temporal layer up only at a layer sync frame ([#​4947](livekit/livekit#4947)) - fix: reconcile everything when the reconcile queue overflows ([#​4948](livekit/livekit#4948)) - fix: enable H.264 publish for desktop Linux Firefox ([#​4949](livekit/livekit#4949)) </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:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNTUuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjE1NS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.hayden.moe/hayden/phoebe/pulls/854
livekit/livekit#4907 (server v1.13.8 and later) restates the subscribed qualities a few seconds after every publisher answer, so the old claim that the server only sends an update when the set changes no longer holds for newer servers. The client-side refresh still closes that window and covers older servers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Servers from v1.13.8 restate the dynacast pause a few seconds after a publisher answer (livekit/livekit#4907), so the layers only stayed on indefinitely with older servers. Scope the release note accordingly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Refresh subscribed codecs after publisher answer (Android) Android publishers keep dynacast-paused simulcast layers paused across publisher renegotiations (publish/unpublish, codec change, ICE restart), instead of silently uploading them until the next subscribed-quality change. * Update license header year on the two mock files * Serialize simulcast layer updates on the RTC thread setPublishingLayersForSender reads and writes RtpSender.parameters, and is now reached from two separate coroutine scopes over the same multi-threaded dispatcher, so the read-modify-write can interleave. Wrapping the shared call rather than either call site keeps the dynacast path and the publisher-answer refresh on one thread. * Note the server-side resend in the refresh KDoc livekit/livekit#4907 (server v1.13.8 and later) restates the subscribed qualities a few seconds after every publisher answer, so the old claim that the server only sends an update when the set changes no longer holds for newer servers. The client-side refresh still closes that window and covers older servers. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Note the server-side resend in the changeset Servers from v1.13.8 restate the dynacast pause a few seconds after a publisher answer (livekit/livekit#4907), so the layers only stayed on indefinitely with older servers. Scope the release note accordingly. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Max Heimbrock <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Every OpenVidu change to a file that comes from livekit/livekit must sit between BEGIN/END OPENVIDU BLOCK, so that an upstream merge shows at once which lines are ours. An audit against v1.13.7 found changes outside them. Each added line and each deletion point of an upstream file was checked to be inside a fence. Lines that are also on livekit/master were left alone: they come from upstream PRs carried as their own commits (livekit#4907, livekit#4910, livekit#4911), which stay unfenced so that the release containing them merges cleanly. The audit left out go.mod, go.sum and blank lines next to a fence. Fenced now: - pkg/routing/selector: AvailableSeconds raised to 30, and the two tests that follow it (any_test.go, utils_test.go). - pkg/rtc/participant.go: the UpdateTrackInfoByVideoSizeChange field of the screen share size change. - pkg/service/turn.go: the relay address check now tests effectiveRelayIP. The existing block above it is extended to cover it. turn_test.go: the NewTurnServer call with its extra argument. - pkg/service/server.go: Start no longer closes closedChan before returning, because it is deferred at the top of Start. A fenced comment marks where the upstream line was. - Imports of OpenVidu code moved into a fenced group at the end of their import block: "time" in egress.go, "math/rand/v2" and github.com/bsm/redislock in redisstore.go, the protocol logger in telemetry/prometheus/node.go. - Dockerfile (COPY openvidu/), buildtest.yaml (the openvidu/main branches) and config-sample.yaml (the relay allocation default of 32, enable_rfc6062 and the reworded allow_restricted_peer_cidrs). - pkg/routing/redisrouter.go: a fence nested inside the RemoveDeadNodes block is removed. gofmt realigns the struct literal fields around a fenced field, so a few upstream lines next to the new fences in participant.go and any_test.go differ from upstream only in whitespace, as in turn.go already. Verified: go build ./..., go vet and gofmt on the changed files; go test -short ./pkg/routing/... ./pkg/service/ ./pkg/telemetry/... ./pkg/rtc/ ./pkg/config/. Re-running the audit finds nothing unfenced. A trial merge into openvidu-pro-livekit, together with its own fence commit, is clean, builds and passes the same tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts: .github/workflows/buildtest.yaml, go.mod, go.sum, pkg/rtc/config.go, pkg/rtc/mediatrackreceiver.go, pkg/rtc/participant.go, pkg/service/server.go and pkg/service/turn.go. Upstream's TURN relay policy (livekit#4992, pkg/service/turnrelay.go) is taken as is: every TURN server refuses RFC 6062 TCP relays, and the embedded one relays to this host's own addresses only on its RTC media ports. It replaces the OpenVidu relay generator (ICE port range check, RFC 6062 opt-in, standalone telemetry): - the media port limit stays for every peer, not only this host, as one fenced wrapper over upstream's chain (openviduRelayPortPolicy): TURNSecurity lets the relay reach the other cluster nodes' private addresses, which sit behind the same firewall. The ports come from upstream's getTURNMediaPorts (the ICE port range, else rtc.udp_port plus 3478 with rtc.use_stun_port_as_ice, none with rtc.force_tcp), and packets to other ports are dropped silently as upstream does; a node with only rtc.udp_port used to drop every relayed packet. - turn.enable_rfc6062 is deprecated and ignored: upstream refuses TCP relays unconditionally, and the key shipped in 3.8.0, so it stays parsed (strict config parsing would refuse the files that set it) and logs a warning. - the standalone relay telemetry duplicated upstream's. TURNSecurity's cluster-node peer allowlist, the relay address resolution, the idle TCP timeout and the quota default stay: upstream declined to limit relay peers to the media nodes. The allow-list check reuses upstream's isRestrictedPeerIP, so the carrier-grade NAT, NAT64 and other special ranges count as restricted too. Upstream's new turnrelay_test.go passes with NewTurnServer's rc argument fenced in. The upstream PRs carried unfenced since 3.9.0 (livekit#4907, livekit#4910, livekit#4911) merge away with no leftover delta. Our tests follow psrpc's move from NewRedisMessageBus to redisbus.New. go.mod takes upstream's versions and keeps our requires (go mod tidy); wire_gen.go merged on its own, and regenerating it only differs in the fence comments. The failed-tests step added upstream to the Test workflow also reads the analytics integration log. Verified: go build and go vet, golangci-lint on the touched packages, go test -short ./... with a Redis on localhost:6379, the 116 TURN tests including upstream's relay policy tests through TURNSecurity, and the analytics integration tests (go test -tags integration ./openvidu/analytics/...). Co-Authored-By: Claude Fable 5.1 <[email protected]>
Fixes #4906.
Problem
Since #4129 (
SetIgnoreRidPauseForRecv), the SFU's answer to a publisher offer drops the RFC 8853 pause markers:The browser applies the answer and re-enables the layers dynacast had paused. Dynacast only notifies changes, so it never sends the pause again, and the publisher keeps uploading those layers until the track's subscribed quality changes. Any publisher renegotiation that does not restart dynacast triggers it, and the layers then stay on indefinitely: publishing or unpublishing a track (e.g. a screen share), a codec change, or an ICE restart without a resume. On a resume,
Restart()already re-sends the qualities afterinitialQualityUpdateWait(10 s), so this PR changes nothing there.Fix
As discussed in #4906, signalling stays the source of truth, and the dynacast state is restated after every answer:
DynacastManager.ResendCommittedQuality()notifies the listener again of the last committed qualities. Nothing new is committed, so a downgrade waiting for its debounce stays pending. I studied the possibility of using the existingForceUpdate()for this, but it commits the pending quality and would skip the debounce. The audio manager gets the no-op fromdynacastManagerNull.onPublisherAnswercalls it for every published track (MediaTrack.ResendSubscribedQuality()), 1 s after sending the answer. The delay is needed because livekit-client'shandleSignalResponsedoes not awaitonAnswer. An update sent right behind the answer is handled beforesetRemoteDescriptionhas applied it, sees the layers still paused, and does nothing.With nothing committed yet, as on an initial publish, the resend does nothing.
Testing
TestResendCommittedQuality: nothing committed means nothing is sent; a resend repeats the committed quality; a pending downgrade is not committed.go test -short ./pkg/...passes.max subscribed qualityagain after the renegotiation. With the current server they stay on. See the image below: now previously paused layers by dynacast are offed again.