Skip to content

fix: keep the last transceiver of the publisher connection - #2282

Merged
lukasIO merged 1 commit into
mainfrom
fix/keep-last-publisher-transceiver
Nov 17, 2026
Merged

lukasIO merged 1 commit into
mainfrom
fix/keep-last-publisher-transceiver

Conversation

@lukasIO

@lukasIO lukasIO commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Since #2249, a participant that unpublishes its only track cannot publish again. The next track is published in the room, but no media arrives, and the publisher connection stays in connecting.

The cause is the stop of the only live m-section of the publisher connection. The browser then rejects all sections of the bundle and drops the ICE and DTLS transport. The next publish reuses the section with a new mid, new ICE credentials and a new DTLS transport. The server restarts ICE on the same connection, but it does not run a second DTLS handshake. #2244 reverted the first version of this change for the same reason.

Change

If a transceiver is the last live m-section of the connection, PCTransport.stopTransceivers does not stop it. That transceiver stays inactive, as before #2249. A negotiated data channel section counts as live, because it also keeps the transport.

The connection keeps at most one such transceiver. The next unpublish stops its own transceiver, because the inactive one is still live.

Verified

  • pnpm test:e2e for src/room/PCTransport.e2e.test.ts in Chromium: 3 tests pass. The new test keeps the only transceiver, so the connection keeps its transport fails without the fix, because the transceiver is stopped and its section is reused.
  • An end-to-end test against a server with protocol 19, in Chrome: publish a camera, unpublish it, publish a microphone, and wait for audio at a subscriber. It fails on main (491d314a) with addIceCandidate errors and no audio after 10 seconds. It passes with this branch.
  • npx vitest run src/room: 793 tests pass. npx tsc --noEmit, eslint and prettier --check pass.

🤖 Generated with Claude Code

A stop of the only live m-section makes the browser drop the ICE and DTLS
transport. The next publish then needs a new transport, and the server
cannot set one up on the same connection, so no media arrives.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@lukasIO lukasIO self-assigned this Nov 16, 2026
@changeset-bot

changeset-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 098c288

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

@lukasIO
lukasIO marked this pull request as ready for review November 16, 2026 18:45
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 117.22 KB (+0.08% 🔺)
dist/livekit-client.umd.js 126.61 KB (-0.04% 🔽)
dist/core/core.mjs 79.69 KB (+0.08% 🔺)

@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

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

I think I get it, make sure there's always at least one transceiver open (of any type) so the webrtc connection stays in a healthy state.

@lukasIO
lukasIO merged commit 4488efe into main Nov 17, 2026
9 checks passed
@lukasIO
lukasIO deleted the fix/keep-last-publisher-transceiver branch November 17, 2026 07:01
@github-actions github-actions Bot mentioned this pull request Nov 17, 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.

3 participants