Repository navigation
rtc: send connection quality to participants that subscribe after their first update - #4838
Merged
Merged
Conversation
…ir first update Added tracking for participants' connection quality updates to ensure all subscribed participants receive necessary updates, even if they were added after the last quality announcement
A failed SendConnectionQualityUpdate must not mark the participant as informed, otherwise the update is never retried while qualities stay stable. Also simplify the untold-subscription check.
Contributor
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)
Comment on lines
+1783
to
1789
|
|
||
| // remember which participants' quality this participant has been sent, | ||
| // only after a successful send so that a failed one is retried on next tick | ||
| told := make(map[livekit.ParticipantID]struct{}, len(update.Updates)) | ||
| for _, info := range update.Updates { | ||
| told[livekit.ParticipantID(info.ParticipantSid)] = struct{}{} | ||
| } |
Contributor
There was a problem hiding this comment.
🟡 Dropped updates suppress later retries
When SendConnectionQualityUpdate drops an update during a signaling outage, toldQualityOf records it as delivered. The new subscription stays unknown until quality changes.
Prompt for agents
The connection-quality worker treats a nil return from ParticipantImpl.SendConnectionQualityUpdate as proof of delivery. However, pkg/rtc/signalling/signallerasync.go WriteMessage returns nil when the participant is disconnected, the handshake is pending, no response sink exists, or the channel has closed. If an untold subscription is processed during that interval, toldQualityOf suppresses all later retries. Change the delivery bookkeeping so dropped signal messages do not mark these participant IDs as informed. Consider exposing actual enqueue/delivery status to this worker or resetting its bookkeeping when a signal connection reopens. Add coverage for a subscription established during a signaling outage followed by resume with stable quality.
Was this helpful? React with 👍 or 👎 to provide feedback.
boks1971
approved these changes
Sep 4, 2026
Contributor
|
thank you @pabloFuente for catching this. |
pabloFuente
added a commit
to pabloFuente/livekit
that referenced
this pull request
Sep 4, 2026
Since livekit#4136 (v1.10.0) nothing registers SubscriptionManager.OnSubscribeStatusChanged, so Room.onSubscribeStatusChanged is never invoked. A participant that subscribes to another one after its first ConnectionQualityUpdate therefore never receives that participant's quality until a level changes (the client shows UNKNOWN indefinitely), and the speaker state a new subscriber used to receive is not sent either. Deterministic with autoSubscribe: false; a race for auto-subscribe when the 5s quality tick lands between the participant becoming ACTIVE and its subscriptions being registered. Fix: register the callback again in setupSubscriptionManager, forwarding to the participant listener, which is I think where livekit#4136 intended to do.
Contributor
|
@pabloFuente I might end up reverting this. Realised that we have a callback for that here - Lines 1317 to 1350 in 407fe3f |
boks1971
pushed a commit
that referenced
this pull request
Sep 4, 2026
pabloFuente
added a commit
to OpenVidu/openvidu-livekit
that referenced
this pull request
Sep 4, 2026
…ir first update (livekit#4838) * rtc: send connection quality to participants that subscribe after their first update Added tracking for participants' connection quality updates to ensure all subscribed participants receive necessary updates, even if they were added after the last quality announcement * rtc: record sent connection quality only after a successful send A failed SendConnectionQualityUpdate must not mark the participant as informed, otherwise the update is never retried while qualities stay stable. Also simplify the untold-subscription check. (cherry picked from commit 407fe3f)
pabloFuente
added a commit
to OpenVidu/openvidu-livekit
that referenced
this pull request
Sep 4, 2026
(cherry picked from commit a8ce398)
Merged
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.
Bug description
connectionQualityWorkeronly sendsConnectionQualityUpdatewhen:Each update contains a participant's own quality plus the quality of the participants it is subscribed to at that tick of the
connectionQualityWorker.If a participant's subscriptions are established after the tick that announce it as a new entrant, the worker never sends it the quality of the participants it subscribed to until one of them changes level. On a stable network that can be never, and the client keeps reporting those remote participants as
ConnectionQuality.UNKNOWN.Fix
Remember, per participant, which participants' quality it was last sent, and also trigger an update when a participant is subscribed to someone it has not been told about yet. The existing send path is reused, so the cost is just one full update per late subscription. Entries of participants that left are dropped every tick.
Proof of the bug
Below is a simple Go file that uses the LiveKit Go SDK to join a publisher and a subscriber participant to the same Room and using
autoSubscribe: falseforces the wrong behavior.Run livekit-server:
Create a temporal folder, initialize a go project and install the LiveKit Go SDK:
Now store this
main.gofile in that same foldercqproof:Then just run the go file and wait for the output:
The livekit-server in
mainwill output something like:A livekit-server with this PR merged outputs: