rtci-host 0.2.0, 0.1.0
From CHANGELOG.md of rtci-host at its release tag.
0.2.0
Tested with rtci 0.4 (was 0.3). A 0.x minor bump because rtci's types are in this crate's API (Peer::create_data_channel takes rtci's RTCDataChannelInit); no API of this crate is removed or changed, and JsEvent has no new variant.
Changed (rtci 0.4)
- Built on
rtci0.4. Of its behaviour changes, these reach a connection of this crate, and are kept (each is what browsers do, or what W3C and the RFCs ask; none conflicts with what this crate promises a front end):- Each SSRC's packets stop carrying the MID, RtpStreamId and RepairedRtpStreamId header extensions once the peer's RTCP has reported on them (RFC 7941 4.2.3, RFC 9143 15; libwebrtc does the same, and browsers keep the SSRC they bound). A new SSRC, a changed value or a completed negotiation sends them again; RTX packets always carry them. The setting for the old form (
with_sdes_header_extensions_on_every_packet) is left off: W3C promises nothing about which packets carry them. AreadRtp()reader sees received packets without them after the first report. - The engine's pacer shares its queue among the waiting video streams by their encodings'
priority(RFC 8835 4.1, the W3Cpriorityweights) instead of releasing in the order written. This crate'sFactorPacerkeeps the pacer and its rate: what it counts as held (for the queue time limit's drain rate) is now kept per SSRC and removed by sequence number as each packet leaves, so interleaved streams, and padding the pacer makes, no longer skew it. The priority weights reach the engine pacer through it unchanged (an RTCP carrier). - RFC 8888 feedback leaves early once a stream has a report's share waiting (about 11,800 packets a second on one stream at the 50 ms interval), instead of waiting for the interval and splitting.
- DTLS 1.2: a bad handshake message in a record that authenticates ends the association with a fatal alert (the DTLS transport, then the connection, goes
failed), where three kinds were dropped silently. - SCTP drops a DATA chunk above the largest TSN while its advertised window is 0 (RFC 9260 6.2), rather than taking a probe into leftover space.
- A received
a=remote-candidatesis parsed and ignored (RFC 9429 5.8): an answer names the pair this side's agent selected. Browsers never send it; two ICE-lite agents (ice_lite) are unchanged. - The other changes (FEC policy, RFC 7728 pause, H.264 / H.265 format parameters by direction, the XR blocks a peer asks for, RTX association by request) apply where the engine's defaults run them; this crate changes none of their settings.
- Each SSRC's packets stop carrying the MID, RtpStreamId and RepairedRtpStreamId header extensions once the peer's RTCP has reported on them (RFC 7941 4.2.3, RFC 9143 15; libwebrtc does the same, and browsers keep the SSRC they bound). A new SSRC, a changed value or a completed negotiation sends them again; RTX packets always carry them. The setting for the old form (
removeTrack/replaceTrack(null)no longer say RTCP BYE in rtci 0.4, but only through the engine's ownreplace_track(None), which this crate never calls: a sender without a track is paused here (set_sender_paused) and its engine streams stay bound, as before. Nothing changes.- The abs-capture-time element this crate writes on a frame's first packet is left out in the last second of a month and the one after (RFC 7164 section 5), as rtci 0.4's
write_rtp_with_capture_timedoes. with_ice_failed_without_end_of_candidates(true)stays (see "End of candidates" in the README).
Added
- A send the socket refuses for its size (
EMSGSIZE, Windows'sWSAEMSGSIZE) is reported to the engine with rtci 0.4'sRTCPeerConnection::handle_datagram_too_big(RFC 6347 4.1.1.1, RFC 9147 4.4): on a direct path from the send itself, and through a TURN relay by tracing the refused TURN message back to the relayed datagram it carried (the last 16 relayed datagrams' first 32 octets are kept for that). A DTLS datagram is quoted, so the engine validates the report and lowers SCTP's packet size too; SRTP and STUN go unquoted. The sockets read no ICMP errors. - The engine's
OnPathMtuExceededis taken: the RTPwrite_framecuts is sized for the path from the next frame (the smallest datagram reported, less SRTP's largest tag). It is logged, not sent to JavaScript (no W3C event). write_framesizes its RTP payloads with rtci 0.4'sRTCRtpSender::max_packet_expansion(RFC 7941 4.2.2): a packet with the header extensions the engine adds stays within 1200 octets, where it could reach about 1218. A frame takes a packet more now and then. When the expansion or the path changes, the packetizer is made again on the same sequence numbers and timestamps.
Fixed
- A gathering phase under the relay-only ICE transport policy (the first one, or the ICE restart a
setConfiguration({ iceTransportPolicy: "relay" })causes) sends to and takes from the peer only through TURN relays (W3C webrtc-pc 4.2.2). The engine, which is not told the policy, keeps the previous generation's selected pair across an ICE restart until the new one selects a pair (RFC 8445 section 9), with its consent checks; after a switch torelaythat host or server-reflexive pair carried the connection on, so neither side ever failed (0.1.0 too, with rtci 0.3; WPT RTCConfiguration-iceTransportPolicy timed out). That pair now loses consent: the side that restarted, with no candidate, fails at once, and the peer as its RFC 8863 PAC timer runs out.
0.1.0
First release, tested with rtci 0.3.
Added
- The engine host extracted from the Denext-Deno fork's
ext/webrtc(branchtrain/denext34):Peer,Network,IceTransport, the media layer, the fake capture devices, and their tests, with nodeno_core,deno_permissions,deno_net,deno_net_route,deno_erroror V8 dependency. NetGate, the net permission gate (replacing the fork'sNetGuard):Reach/ReachKind/Host/Proto/Directiondescribe each question,Verdictanswers it,DenyAllGaterefuses everything.NetIo, the socket factory (UDP, mDNS, TCP listen and connect, DNS, route probes), withPlainNetIoon the operating system's sockets and themdns_sockethelper for routed implementations.Error { kind: ErrorKind, message }in place of the fork'sWebRtcError.JsEvent<P>/FakeFrame<P>hold received bytes asPayload(Bytes);map_payloadswaps in a front end's own buffer type.- The
serdearguments and results the front ends share (ConfigArg,IceServerArg,CandidateArg,DataChannelArg,CreatedChannel,KeygenArg,CertificateInfo,FingerprintInfo),parse_ice_servers,check_ice_servers,needs_tls. - Certificate helpers:
generate_certificate,certificate_fingerprints,certificate_to_pem,certificate_from_pem,expires_ms,CertificateStore. - The engine log-level helpers:
set_engine_log_level,engine_log_level,is_engine_log_target. Peermethods for every media call the front ends make (add_transceiver,write_frame,set_receiver_read_rtp, ...).- The asynchronous permission gate. When
NetGate::decide(orinterfaces) returnsNone, the engine callsaskonce per question per connection and waits for it. Until the answer is an allow, no socket is bound, no name resolved and no datagram sent. Sends to an address still being asked are dropped and counted inpacketsDiscardedOnSend; binds, ICE servers and remote candidates wait. Answers are cached per connection, keyed by theReachwithout its kind, and questions in flight are deduped. A timeout (NetGate::ask_timeout, defaultDEFAULT_ASK_TIMEOUT, 10 s), a panicking gate and a dropped request are refusals. A gate that always decides synchronously behaves as before. AskGate: an asynchronous gate whose questions queue asGateRequests (thegaterequestevent:{"type":"gaterequest","ticket","kind","dir","proto","host","port","resolvedFrom"}) and are answered by ticket (AskGate::answer). It refuses everything untilattach()(NO_GATE_REGISTERED) and remembers answers for every connection on it.GateToken, which the engine mints from an allow. EveryNetIocall that creates a socket or resolves a name takes one.JsEvent::OpDone(theopdoneevent,{"type":"opdone","op","error"?}) andSerializeforError({"kind": ErrorKind::name(), "message"}).Network::create:Network::newfor a gate that answers later.- ICE-TCP active dials are asked as
ReachKind::TcpDial. - The engine asks
ReachKind::IceServerfor each ICE server URL before resolving it, so a front end no longer has to (check_ice_serversstays, for front ends that want a refusal to fail the constructor). Proto::as_str,Direction::as_str,ReachKind::as_str.rtci_webrtc.js(js/): the W3C WebRTC API overrtci-ffifor a Deno runtime without built-in WebRTC, on the Denext-Deno fork's shared W3C factories (vendored):install({ replace, prompt })/load(), the transport overEngine(waker, drain, ref/unref, two-phase operations), the permission gate overDeno.permissions(net-connect/net-listenprobed,netotherwise), and a checksum andbuildId()check before and after opening the library. Data channels only; media, encoded transforms and transfer throwNotSupportedError.
Changed (breaking for code written against the first extraction)
Peer::set_remote_descriptionandPeer::add_ice_candidatereturnResult<u32>, an operation id, in place ofResult<()>. They are two-phase:Erris only an argument error (a closed connection, an oversized description, an invalid type, a malformed candidate). The outcome, including a refused candidate (NotCapable) and the engine's own errors, is theopdoneevent for that id. With a synchronous gate it is queued before the call returns.NetIomethods take a&GateTokenfirst:bind_udp(token, addr, opts),bind_mdns(token, hosts),bind_tcp(token, addr),connect_tcp(token, bind, to, host),resolve(token, host, port).route_probeis unchanged.IceTransport::gathergathers once the gate has answered for the binds (at once with a synchronous gate). Its candidates still arrive as events.- With an asynchronous gate that hasn't answered at construction, a connection resolves
.localcandidates once the gate allows mDNS, but does not publish its own host candidates under mDNS names (it reports why in anicecandidateerror). DENO_WEBRTC_LOOPBACK_ONLY=1asks for the127.0.0.1bind like any other bind (it used to skip the gate).JsEventhas a new variant (OpDone), so an exhaustivematchon it needs an arm.
Changed (rtci 0.3)
- Built on
rtci0.3 (was 0.2). No API of this crate changes for it. - ICE is
failedonly once no candidate is to come (rtci 0.3, W3C webrtc-pc 5.6.4): local gathering complete, which this crate signals to the engine itself, and the peer's end-of-candidates (add_ice_candidatewith an empty candidate,a=end-of-candidates, or a remote description withouta=ice-options:trickle). Until then a lost or never found path isdisconnected. A front end must pass the application'saddIceCandidate()/addIceCandidate(null)/{candidate: ""}through as an empty candidate; an application that never relays the peer's end-of-candidates seesdisconnected, notfailed. - A connection with local candidates and none from the peer is no longer failed by this crate as soon as both sides end their candidates: the engine's RFC 8863 PAC timer (39.5 s with the defaults) waits for a check from the peer, which can still form a peer-reflexive pair. With no local candidate at all it still fails at once.
- Answers list only the formats the offer has, in the offer's order: the engine's own answer now (rtci 0.3's default), so this crate no longer rewrites it (the payload-format filter of the Denext-Deno fork's DENEXT.md item 565 is gone). Answers say
a=ice-optionsas the offer did (tricklealone to browsers). - After a remote answer, a sender's
getParameters().codecslists every format of the answer this side can send, one the answer added beyond the offer included (RFC 9429 section 5.11), in the answer's order. - A TURN username or credential that is not an RFC 8265 OpaqueString (a control or default-ignorable code point) is refused with InvalidAccessError when the servers are parsed (
IceServerSpec::parse, so the constructor andsetConfiguration), as W3C webrtc-pc 4.4.1.5 asks and rtci 0.3 does for its own configuration. - A remote answer with an
a=rtcp-fbline its offer lacked is refused (OperationError), and a received rid-id with-or_or over 255 characters is discarded (rtci 0.3 defaults).