Repository navigation
Create data channels as negotiated in single PC mode (protocol 18) - #1527
cnderrauber wants to merge 1 commit into
Conversation
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>
Changeset incompleteThis PR's changeset is missing version bumps for packages that are affected by the change. The following packages still require a bump:
Already covered:
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 If this change doesn't require a version bump, add the |
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| DataChannelInit { | ||
| ordered: true, | ||
| negotiated, | ||
| id: if negotiated { NEGOTIATED_RELIABLE_DC_ID } else { -1 }, |
There was a problem hiding this comment.
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)?; |
There was a problem hiding this comment.
| 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)?; |
| // The SCTP section is already in the offer, so in-band channels can be | ||
| // opened on it without renegotiation. |
There was a problem hiding this comment.
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.
| livekit: minor | ||
| livekit-signaling: minor |
There was a problem hiding this comment.
| livekit: minor | |
| livekit-signaling: minor | |
| livekit: minor | |
| livekit-signaling: minor | |
| livekit-api: minor | |
| livekit-capture: minor | |
| livekit-ffi: minor |
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.