Skip to content

Enable WARP (SPED + SNAP), gated by the server - #1138

Merged
pblazej merged 1 commit into
mainfrom
blaze/warp
Sep 28, 2026
Merged

pblazej merged 1 commit into
mainfrom
blaze/warp

Conversation

@pblazej

@pblazej pblazej commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Enables WARP (draft-uberti-tsvwg-warp). This is the best of #1128 (@cloudwebrtc) and #1094 (@hiroshihorie) merged into one PR, and it supersedes both.

  • SPED (DTLS in STUN): the WebRTC-IceHandshakeDtls field trial, passed to LKRTCPeerConnectionFactory.configureFieldTrials right before the factory is built. This avoids the deprecated LKRTCInitFieldTrialDictionary.
  • SNAP (SCTP INIT in SDP): enableSctpSnap = true in LKRTCConfiguration.liveKitDefault(). Every configuration, including the setConfiguration calls on quick reconnect and early-publisher adoption, is built from it. So this immutable field never changes after the peer connection exists, which was the INVALID_MODIFICATION trap in Add WARP support (DTLS handshake carried in the ICE exchange) #1128.

WARP is always on, with no public API and no runtime switch, the same as rust-sdks#1342. The server decides whether WARP engages. A server without WARP ignores the offer and the connection falls back to the standard handshake.

SPED was turned off in #1015 on suspicion of #929. That crash turned out to be the ADM fine_audio_buffer_ null dereference, fixed in #1041.

Testing

WARPTests checks that the offer carries both goog-sped-v1 and a=sctp-init:. Removing either leg makes it fail (verified).

End to end, against local livekit-server 1.13.7 (the latest release; it ships the livekit/ice v4.4.0-warp.2 / dtls v3.1.5-warp.1 / webrtc-pion v4.2.18-warp.1 forks). The test connects two rooms and sends one reliable packet:

rtc.enable_warp: true WARP off
SPED completes on both active transports: libwebrtc logs DTLS-STUN piggyback complete with success=1, the SFU logs Done with the SPED handshake not engaged
SNAP a=sctp-init in all four SDPs (client offer, SFU answer, SFU offer, client answer) only in the client offer; the SFU drops it
data round trip ✅ ✅

To reproduce, add this to the server config: rtc: { enable_warp: true } and logging: { pion_level: debug }.

Server-side fixes

WARP needs a server with livekit/livekit#4916 (on master, not yet in a release). Against livekit-server 1.13.7, SPED causes two problems. Neither is a client bug, and both are fixed in LiveKit's pion forks:

Measured locally on loopback with this PR's client. For the data rows, a fresh pair of rooms is used per iteration, with n=10 for first messages and n=5 for bursts.

1.13.7 master (#4916)
First reliable message after connect (dual PC) 9/10 took 3.4–12.4 s 12–14 ms
First reliable message after connect (single PC) ~0.4 s 11–13 ms
100 lossy messages right after connect 0–96 delivered 100/100
100 reliable messages right after connect 100/100 100/100
SFU SCTP retransmit timeouts 21 0

The connect-time rows are BM-CONN: dual PC, n=25, p50 / p90.

Client 1.13.7, WARP on master, WARP on Server without WARP
with WARP (this PR) 34 / 40 ms 18 / 38 ms 53 / 81 ms
without WARP 127 / 132 ms 45 / 76 ms 43 / 63 ms

CI's dev server doesn't enable WARP, so CI doesn't exercise either path.

Always on, no runtime switch: SPED (DTLS in STUN) via the
WebRTC-IceHandshakeDtls field trial passed to configureFieldTrials before
the factory is built, SNAP (SCTP INIT in SDP) via enableSctpSnap on the
default configuration. Neither engages unless the server negotiates it.

Supersedes #1128 and #1094.

Co-Authored-By: cloudwebrtc <duanweiwei1982@gmail.com>
Co-Authored-By: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

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

Devin Review

Comment thread Sources/LiveKit/Core/RTC.swift
@pblazej

pblazej commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Stability fixes should come after #1131

@pblazej
pblazej merged commit 128d708 into main Sep 28, 2026
28 of 33 checks passed
@pblazej
pblazej deleted the blaze/warp branch September 28, 2026 10:46
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