v0.4: Trickle-ICE on WHIP ingest handler #21
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The current WHIP handler requires the publisher to send a complete SDP offer in the initial
POST. OBS Studio (≥ 30.1) and most browser-based WHIP publishers use trickle-ICE: they send an incomplete SDP offer and then stream ICE candidates viaPATCHrequests as they are gathered.Without trickle-ICE support, OBS and browser publishers stall waiting for ICE gathering to complete before sending the offer, which adds 1–3 s of setup latency and may time out on networks where gathering is slow.
Work
The WHIP spec (draft-ietf-wish-whip §4.4) defines:
POST /api/v3/whip/{id}— accepts an offer witha=ice-options:trickleand returns a201answer immediately (before ICE is fully gathered on the server side).PATCH /api/v3/whip/{id}/{resource}— acceptsapplication/trickle-ice-sdpfragbodies containing individual ICE candidates, forwarded topc.AddICECandidate(). Returns204.PATCHwith an empty body (ora=end-of-candidates) signals the end of trickle.app/webrtc/whip_handler.go— add aPATCHroute; store the*webrtc.PeerConnectionper resource ID so candidates can be forwarded; parsetrickle-ice-sdpfragfragments.core/webrtc/peer.go—CreatePeerFromSourcescurrently blocks onGatheringCompletePromisebefore returning. Add aCreatePeerFromSourcesTricklevariant (or a flag) that returns immediately with an incomplete answer and completes gathering asynchronously.app/webrtc/whip_handler.go— thePOSThandler should detecta=ice-options:tricklein the offer SDP and switch to the trickle path.Tests — a
TestWHIP_TrickleICE_*suite inwhip_handler_test.gosimulating a publisher that sends offer → PATCH candidates → final PATCH.