Skip to content

Create data channels as negotiated in single PC mode (protocol 18) - #1527

Open
cnderrauber wants to merge 1 commit into
mainfrom
jie/negotiated-data-channels
Open

cnderrauber wants to merge 1 commit into
mainfrom
jie/negotiated-data-channels

Conversation

@cnderrauber

Copy link
Copy Markdown
Contributor

Use fixed SCTP stream IDs (100/101/102) for the publisher data channels so the server can send on them without waiting for the client's DCEP OPEN, saving about one RTT of server->client readiness. Falls back to in-band channels when the server protocol is below 18 or it doesn't use single PC.

Use fixed SCTP stream IDs (100/101/102) for the publisher data channels so
the server can send on them without waiting for the client's DCEP OPEN,
saving about one RTT of server->client readiness. Falls back to in-band
channels when the server protocol is below 18 or it doesn't use single PC.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Changeset incomplete

This PR's changeset is missing version bumps for packages that are affected by the change. The following packages still require a bump:

  • livekit-api
  • livekit-capture
  • livekit-ffi

Already covered:

  • livekit (minor)
  • livekit-signaling (minor)

A package must be bumped when its own files change, and whenever a package it depends on is bumped (so downstream consumers get a matching release).

Click here to create a changeset for the missing packages

The link pre-populates a changeset file with patch bumps for the missing packages. You can also add them to your existing changeset. Edit the bump types as needed before committing.

If this change doesn't require a version bump, add the internal label 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: 1 flag

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

Devin Review

DataChannelInit {
ordered: true,
negotiated,
id: if negotiated { NEGOTIATED_RELIABLE_DC_ID } else { -1 },

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.

realising now that we've been setting this to -1 by default, while the spec suggests to use None instead.

@cnderrauber I'm guessing from the server's perspective that doesn't matter?

);

let dcs = Self::create_data_channels(&publisher_pc, &emitter)?;
let dcs = Self::create_data_channels(&publisher_pc, &emitter, true)?;

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.

Suggested change
let dcs = Self::create_data_channels(&publisher_pc, &emitter, true)?;
// always try to open negotiated data channels and close them if we know the server doesn't support it after receiving the join response
let dcs = Self::create_data_channels(&publisher_pc, &emitter, true)?;

Comment on lines +618 to +619
// The SCTP section is already in the offer, so in-band channels can be
// opened on it without renegotiation.

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.

this sounds like magic to me, can you explain how this works for older servers?
a couple of lines down we create the data channels with negotiated: false which makes it sound like we would still need negotiation.

Comment on lines +2 to +3
livekit: minor
livekit-signaling: minor

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.

Suggested change
livekit: minor
livekit-signaling: minor
livekit: minor
livekit-signaling: minor
livekit-api: minor
livekit-capture: minor
livekit-ffi: minor

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