Skip to content

fix: stop the transceivers of an unpublished track - #2249

Merged
lukasIO merged 1 commit into
mainfrom
reapply-stop-unpublished-transceiver
Nov 16, 2026
Merged

lukasIO merged 1 commit into
mainfrom
reapply-stop-unpublished-transceiver

Conversation

@lukasIO

@lukasIO lukasIO commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Reapplies #2221, which #2244 reverted. #2160 must merge first because of the protocol update.

🤖 Generated with Claude Code

Reapplies #2221, which #2244 reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lukasIO lukasIO self-assigned this Nov 10, 2026
@changeset-bot

changeset-bot Bot commented Nov 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f7cb95e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
livekit-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@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 found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread src/room/RTCEngine.ts
Comment on lines +189 to +191
get serverProtocol(): number | undefined {
return this.latestJoinResponse?.serverInfo?.protocol;
}

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.

🟡 Transceiver cleanup lost after signal resume

When a reconnect response omits serverInfo, serverProtocol loses the protocol advertised at join. resumeConnection replaces the saved server info with that missing field. Later unpublishes retain transceiver encoders until disconnect.

Learn more

The engine reads serverProtocol from its last join response. A signal resume can return a valid reconnect response without serverInfo; resumeConnection then assigns that absent field to the saved join response. removeTrack consequently disables stopping transceivers, even if the existing peer connection joined a protocol-19 server. Its stopped encoders remain allocated until disconnect.

Example: Join with serverInfo.protocol = 19, then resume signaling with a ReconnectResponse containing ICE servers but no serverInfo. Unpublishing a screen share calls removeTrack without stopping its transceiver, unlike an unpublish before resume.

Recommended fix: Preserve the last known protocol for the current peer connection when a reconnect response omits serverInfo. If a resume can switch to a different server version, define how to validate that version before retaining the protocol. Add a reconnect regression test covering a missing serverInfo.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

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.

Interesting case, this might be worth validating / adding a test to cover either way.

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 116.85 KB (+0.12% 🔺)
dist/livekit-client.umd.js 126.2 KB (+0.12% 🔺)
dist/core/core.mjs 79.54 KB (+0.15% 🔺)

@1egoman 1egoman 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.

Makes sense to me at a high level.

@lukasIO
lukasIO merged commit 491d314 into main Nov 16, 2026
6 checks passed
@lukasIO
lukasIO deleted the reapply-stop-unpublished-transceiver branch November 16, 2026 16:11
@github-actions github-actions Bot mentioned this pull request Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants