Repository navigation
refactor(moq-webrtc): run on upstream str0m instead of a vendored copy - #8963
Conversation
Quest-Claim: d0ea5f783f48cb5b
The vendored copy stays in place for comparison; the next commit deletes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
About 98,600 lines and 1.6 MB of packet captures, with the workspace dependencies only that copy used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
str0m 0.25 has no setting that refuses one: it accepts the m=application section and runs SCTP nobody reads. The gateway takes those sections out of the offer and puts each back rejected in the answer, as the vendored copy answered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1: the vendored copy started ICE's clock at once, put the answer's candidates on the first accepted section, and (as a dropped data channel's section) kept a max-bundle offer's shared transport. Upstream does none of these, so the gateway does them at its boundary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SRCs Without that, a DTLS or media timer starts ICE's clock and the test passes without the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…idates Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed 206b3daf1644a03f513040eb46dc4693c7b362fa. Moving back to upstream is worthwhile. P2, rs/moq-webrtc/src/sdp.rs:90–100: validate rejected application m-lines before stripping them. Append an application section such as m=application 9 UDP/DTLS/SCTP (missing its format) to an otherwise valid media offer. The shim removes the malformed section before str0m can reject it, then emits an equally malformed m=application 0 UDP/DTLS/SCTP in an otherwise successful answer. Reject malformed input as InvalidSdp instead of opening a session with an answer the peer cannot apply. Add this case and check that removed sections can't hide a duplicate MID shared with a retained section.
The first ICE timeout and accepted-section candidate moves address the observed integration gaps. Keep the real browser WHIP/WHEP check at the pin bump; I did not rerun it.
There was a problem hiding this comment.
Important
The new data channel refusal in sdp.rs rewrites an untrusted offer before str0m sees it, and its transport hoisting does quadratic work in the number of offer lines.
Reviewed changes
Reviewed the switch from the vendored WebRTC stack to crates.io str0m 0.25 with rind-str0m, and the three behaviors that moved to moq-webrtc's boundary.
- Upstream str0m + rind crypto:
session::rtc_configinstallsrind_str0m::default_provider()(its CPU check is the samerind::cpu::checkthatmoq_crypto::cpu::checkruns, so theexpectholds) and pins DTLS 1.2.enable_opusgainsuse_red = false. - ICE's first timeout:
Agent::newfeedsInput::Timeout(now)through the drainingrtc_mut()guard, so an answerer facing an ICE-lite peer starts its checks. A new test covers this. - Data channel refusal:
parse_offertakesm=applicationsections and their BUNDLE mids out of the offer text and hoists a bundled section's transport to session level.render_answerputs each section back asm=application 0at its index. I checked the hoist against str0m 0.25: it reads creds, fingerprint, and setup from the session or any media line, and dedupes candidates with aHashSet(src/sdp/data.rs:62-104). - Candidates on a rejected first section:
candidates_on_acceptedmoves them to the first accepted section. - Deletion and cleanup: removes
vendor/, its workspace deps, the nix source filter, and the sdist exclude, and prunes the quests that only existed for the vendored copy.
claude-opus-5-5 | 𝕏
Decide the carried transport keys once and check mids against sets, so a flood of transport lines or data channel sections in one request costs linear work. Every candidate moves to the session: str0m dedupes them. Drop the workspace's arrayvec and crc entries, which nothing uses now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found. Both earlier findings are fixed cleanly.
Reviewed changes
Reviewed 71b993a, which fixes the two findings from the prior Pullfrog review.
- Linear
refuse_channels: the carried transport keys are now worked out once intotaken, which has at most 7 entries. Every candidate is hoisted without dedupe, since str0m already dedupes them. The BUNDLE group and the refused mids are nowHashSets, so lookups per section and in the group rewrite are O(1).a_flood_of_refused_transport_stays_linearsends 100k each of transport lines, candidates, and sections, and checks that each non-candidate key is hoisted only once. - Workspace deps: removed the unused
arrayvecandcrcentries from root[workspace.dependencies].
claude-opus-5-5 | 𝕏
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Head: 71b993a910e939063f95bf85eff4e949a4ab4a50
The latest delta removes the repeated scans in refuse_channels and preserves candidate order. The new test is a shim-only check, not a bound on offer handling: str0m 0.25 deduplicates parsed candidates, but ICE still scans its accumulated candidates and pairs as it adds distinct entries. Keep the linear claim scoped to the shim; if bounding request cost is a goal, add a candidate budget and test it through the offer/answer entry point.
The prior malformed application m-line and duplicate-MID validation finding is still open: those sections are still stripped before str0m parses the offer. Static review only.

moq-webrtc runs on crates.io str0m 0.25 with rind as its crypto through
rind-str0m0.25.2 (andrind-dimpl0.9.3 under it), andrs/moq-webrtc/src/vendor/is gone: 100,590 deleted lines across 258 files, the 1.6 MB of packet captures included. Finishes quest/m2/str0m-upstream.md.What differed between the vendored copy and 0.25
The quest asked for this report before the deletion. The first commit (
25df4e88c2) builds against 0.25 withvendor/still in place. Nothing the gateway needs is missing upstream, but three patches the vendored copy carried over str0m (found by review round 1) had to move to moq-webrtc's boundary, as did the data channel refusal.RtcConfig::enable_opustakes a seconduse_redargument (RFC 2198 RED). It is passedfalse, which keeps today's offer. The 13 files only had their imports switched.default-features = false, str0m has no provider of its own and panics inRtc::buildwithout one.session::rtc_confignow sets rind-str0m's provider on every config. Two tests built anRtcwithRtc::builder(), and they now usertc_configtoo.accept_offeranswers an offeredm=applicationsection accepted (port 9, in BUNDLE) and starts SCTP. To keep the decided behavior,sdp.rstakes each such section and its BUNDLE mid out of the offer text before str0m parses it, then puts each back into the answer at its index asm=application 0 <proto> <fmts>withc=anda=mid. That is the answer the vendored copy gave. sctp-proto is still compiled in.poll_timeout(added in moq-dev/moq#8163) asked for an immediate timeout once ICE had a remote candidate. Upstream ICE has no clock and asks for no timeout until its first one. So an answerer that hears no checks and has no DTLS or media timer, such as one facing an ICE-lite peer, never sent a check.ice::Agent::newnow feedsInput::Timeout(now)before draining.src/change/sdp.rs:825), even when that section is rejected and out of BUNDLE. An example is WHEP audio offered first against a video-only broadcast. The vendored copy moved them (moq-dev/moq#8771).sdp::render_answernow moves them to the first accepted section.a=bundle-only. When that section is the data channel being refused,sdp::refuse_channelsmoves each of those attributes the rest of the offer lacks, and every candidate, to the session level, where str0m reads them.DtlsVersion::Dtls12, and rind-str0m builds dimpl withnew_12for it.rtc_confignow pins 1.2 explicitly, so a later default of Auto or 1.3 can't change the wire unnoticed. Chrome negotiated DTLS 1.2 (FEFD) in the run below.CryptoError::Other(format!("DTLS error: {e}"))(src/dtls.rs:164,:182,:200,:207), though str0m-proto 0.8 hasCryptoError::DtlsImpl. moq-webrtc's handling (RtcError::Dtls(_)before ICE connects reads as a timeout) works the same.quest/m3/webrtc/dtls-timeout.mdnow records this.b=per section: 0.25 still parsesbw: Option<Bandwidth>, so theb=TIASsplice stays.quest/m4/webrtc-sdp-bandwidth.mdrecords this.mainafter 0.25: these include zero-length TWCC chunks panicking (algesten/str0m#1143) and ICE candidates with port 0 (algesten/str0m#1148). The vendored copy (dc317173) lacked them too, so this is no regression. They arrive with the next str0m release through a plaincargo update.Changes
Cargo.toml: addsstr0m0.25 (default features off, so aws-lc-rs stays out) andrind-str0m0.25.2. Drops the workspace entries only the vendored copy used:aes,ccm,combine,fastrand,nom,once_cell,pcap-file,spki,subtle, andx509-cert.workspace-hackandnix/Cargo.nixare regenerated.rs/moq-webrtc/Cargo.toml: depends onstr0mandrind-str0min place of the vendored stack's own dependencies.rindbecomes a dev-dependency, used for the STUN signing in a mux test. Theexcludeof the captures and the cargo-shearignored-pathsare gone.rs/moq-webrtc/src/vendor/is deleted with itsLICENSE-*files and its module lint allows.rs/moq-webrtc/src/sdp.rs:parse_offerreturns(SdpOffer, Refused), andrender_answertakes theRefusedback and moves candidates off a rejected first section. Five tests cover this:refuse_channelsstays linear in the offer: the carried transport keys are decided once, BUNDLE mids are checked against sets, and every candidate moves (str0m dedupes them).a_flood_of_refused_transport_stays_linearfeeds it 100k each of transport lines, candidates, and data channel sections. The workspace's now-unusedarrayvecandcrcentries are dropped too.rs/moq-webrtc/src/ice/agent.rs:Agent::newstarts ICE's clock. Covered by an ICE-lite test.doc/bin/rtc.mdno longer says the stack is vendored..oss-scanner/threat_model.md,pyproject.toml's sdist exclude of the captures, andnix/crates.nix's filter for dimpl's validation data are updated to match.#[path]bullet intest-inventory-followups.md.quest/m0/rind-adapters.mdnow says rind 0.4 needs patch releases ofrind-str0mandrind-dimpltoo. Its vendored-file sites are gone.Public API and wire
Public API: none. The
vendormodule was private.Dependencies: str0m, str0m-proto,
is, dimpl, sctp-proto,rind-str0m, andrind-dimpljoin moq-webrtc's published graph, socargo denysees their advisories again.cargo deny checkreports bans, licenses, and sources ok, and advisories fail only on zbus's unmaintained crates. That failure is already onmainand is handled by moq-dev/moq#8966.Wire: none toward browsers. An offered data channel is still answered rejected and left out of BUNDLE, and DTLS stays 1.2.
Decisions
Taken while the maintainer was away. A review can undo each one.
rind-str0mandrind-dimplrequire rind 0.3, the same as the workspace (Cargo.lockstays on rind 0.3.2). fix!: build against rind 0.4 and its corrected adapters #8432 now has to raiserind-str0mas well, and its quest says so. The rind 0.4 release needsrind-str0mandrind-dimplpatch releases.moq_crypto::cpu::check()ahead of rind-str0m's own check, with an.expecton the second because it can't fail. The alternative was to add arind_str0m::MissingFeaturevariant to the publicError. fix!: build against rind 0.4 and its corrected adapters #8432 removes both checks.Upstream draft for the maintainer
Not filed. str0m is outside the orgs, and its reports wait on your approval (upstream reports). Draft:
Validation
cargo test -p moq-webrtc --all-featurespasses 88 tests. The three review-round tests each fail with their fix removed. The ICE-lite test ends withTimeoutafter the 30 s establish deadline, and the two SDP tests fail their asserts.whip_and_whep_round_trip_opusand the other gateway tests run a real DTLS handshake over str0m 0.25 with rind.cargo clippy -p moq-webrtc -p moq-cli --all-targets --all-features -- -D warningsis clean.just checkpasses on206b3daf16. Earlier, the first run passed every module, all 12,655 Rust tests included, except a stalenix/Cargo.nix, which is now regenerated. On the rerun every module passed excepttest rs: fourmoq-netroute::tests::handoff::pathtests hit nextest's 60 s timeout on the loaded host (outside moq-webrtc, and they passed in the first run). They pass alone (35/35 of that group).moq-relayandmoqbinaries servedimport rtc --listen(WHIP) andexport rtc --listen(WHEP) over Tailscale to Chrome 157 on another host. A page published a canvas track over WHIP, then played it back over WHEP, once with a data channel added to both offers and once without:connected.FEFD(1.2),TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, with SRTPAEAD_AES_256_GCM.m=application 0 UDP/DTLS/SCTP webrtc-datachannelwitha=group:BUNDLE 0, and Chrome accepted it.m=audio 0,a=group:BUNDLE 1) with the candidate on the video section, and the player decoded 247 frames.an_offered_data_channel_is_answered_rejected.rs/moq-cli/src/rtc.rshas no tests). The binary run above stands in for them.Follow-ups
quest/m4/upstream-reports.mdgains two candidates under the same approval rule as the other str0m candidates: the data channel switch drafted above, and the two str0m bugs moq-webrtc now works around (candidates on a rejected first section, and no ICE timeout before the first).quest/m2/str0m-upstream.md, which this PR deletes, and both PRs touchsession.rsand the server modules. moq-dev/moq#8949 touchesrs/moq-webrtc/Cargo.tomlandserver/whip.rs. Whichever PR lands second merges the other and resolves the conflicts.Models
Size: L
Implementer: Claude Code, claude-opus-5-5, high effort
Iterated: Claude Code, claude-opus-5-5 (iterate, S)
🤖 Generated with Claude Code
(Written by Opus 5.5 with high effort)
Review
Rewritten by
quest reviewafter each round.Head: 71b993a
Base: origin/main at fc38289
Risk: high,
The overall replacement changes SDP/ICE wire behavior relied on by WHIP senders and WHEP browsers, so interoperability failures could prevent connections until fixed or reverted.Classified: medium by default
Reviewer: Codex, gpt-6.1-sol, xhigh effort
Session:
01a1e55e-d6d2-7212-8cf6-d55d6eead26c, round 4Score: 10/10,
The follow-up removes unused workspace dependencies and eliminates quadratic SDP filtering without introducing issues found by code inspection.Raised the risk to high:
The overall replacement changes SDP/ICE wire behavior relied on by WHIP senders and WHEP browsers, so interoperability failures could prevent connections until fixed or reverted.Rounds: 4; first round 3 (high 1, medium 2); findings 3 (high 1, medium 2): fixed 3, refuted 0, open 0
Findings: none