Repository navigation
fix(moq-webrtc): a WHEP pull announces once its catalog exists and survives a mid-group join - #8997
Conversation
Quest-Claim: 87e809c6336d3145
… late frames Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… failed dial Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This review covers the full PR at 185d0ac. The PR fixes the startup race in the WHEP pull's announcement and makes the WebRTC ingest tolerate a mid-group join and late frames.
- Caller-owned catalog for
Client::pull:pullnow borrows abroadcast::Producerand acatalog::Producer, matchingmoq_rtsp::Client::pull. A dial that fails before the session starts aborts the catalog.catalog::Producer::abortreturns early when the catalog is already closed, so a cause the session set first is kept. - Hidden-until-catalog announce in
moq import webrtc --connect: The route is created hidden and announced on the catalog's first update, the same wayrs/moq-cli/src/rtsp.rsdoes it. The announce future ignores catalog errors, so the pull reports its own failure. IngestOrderper-line admission: Frames are filtered on each line's raw RTP time beforeIngestClock::normalize. Dropped frames never move the session clock. A video line waits for str0m'sis_keyframeand paces PLI to once a second, and only on lines that negotiatedfb_pli. str0m's keyframe flags agree with what moq-mux accepts as a group opener, including H.265 IRAP. Audio drops anything that is not strictly later than its last frame, and video drops anything before its last keyframe.IngestSink::newis infallible:IngestSink::routedstill creates its catalog from a config. The tests and thelib.rsintegration tests use the new signatures.
claude-opus-5-5 | 𝕏
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed 185d0ac53e01b227071c3f060ca9b83f962df0ab. No blocker found. Deferring the route announcement until a catalog update closes the early-export race, and aborting the catalog on a failed dial makes the wait terminate. Filtering against the original per-line RTP time before normalization is the right place to drop late frames; the video gate leaves in-group delta reordering alone. The hidden-route failure fixture and admission tests cover the important cases in code. Static review only; I didn’t rerun WHEP/WHIP or the gateway chain.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This review covers what changed since 185d0ac. The delta is documentation only.
- Follow-up quest added:
quest/m2/whep-chain-shutdown.mdrecords the clean-shutdown work for a chained WHEP pull (clock drift on stop, unfinished tracks). - Roadmap link:
quest/m2/README.mdlinks the new quest and drops a duplicatedmoq-vaapientry.
claude-sonnet-5-5 | 𝕏

Problem
moq import webrtc --connect <whep> -- export rtmp --connect <rtmp>(a WHEP pull chained to another gateway in one process) failed at startup:init FLV export: moq: not found. The CLI announced the pulled broadcast beforemoq_webrtc::Client::pullhad created its catalog track, so an export or viewer resolving it early found no catalog.With that fixed, the same chain still failed most starts, inside the WHEP ingest itself (a lone
import webrtc --connectfailed 4 of 8 starts onmain):missing keyframe: a group must open on a keyframe: the RTP stream joined mid-group, and the first video frame could not open a group.frame timestamp 0 µs is below the previous group's start 20000 µs: the egress's held-before-connect burst arrives reordered (seen in a trace: the first ~34 Opus frames arrive scrambled, then in order), and a late Opus frame rewinds a published group.Each of these alone ends the session, so the chain from the quest only restreams once all three are fixed.
Approach
moq_webrtc::Client::pulltakes the catalog producer, matchingmoq_rtsp::Client::pull. The CLI creates the route hidden and announces it after the catalog's first update, asrs/moq-cli/src/rtsp.rsdoes. A viewer that arrives first waits for the announcement instead of failing.IngestOrder) before they reach the codec bridges:Client::pullfails before its session starts (an HTTP error, bad SDP), it aborts the caller's catalog with that error, so readers see the failure instead of waiting.IngestSink::newtakes a catalog producer;IngestSink::routed(WHIP server) still builds one from a config.Impact
moq_webrtc::Client::pull(url, broadcast, catalog)now takes&broadcast::Producerand&moq_mux::catalog::Producerinstead of an owned producer and acatalog::Config. Migrate: build the catalog withmoq_mux::catalog::Producer::new(&mut broadcast, config)and pass references to both. moq-webrtc has not been published to crates.io, so the title takes no!.moq import webrtc --connectannounces its broadcast only once the catalog names a track.Validation
moq import fmp4 -- export webrtc --listen(WHEP server), the chain under testmoq import webrtc --connect http://…/src -- export rtmp --connect rtmp://…/live/out, and a sinkmoq import rtmp --listen -- export rtmp --listenthatffprobe -rtmp_enhanced_codecs avc1,Opusplays.main: the chain exited at startup in all 3 runs (init FLV export: moq: not foundtwice, the timestamp rewind once), and the sink never got a stream.h264 320x240andopusfrom the sink in the last 4 runs. (Earlier runs used 1 s fragments, which burst audio and made the export skip it, so only Opus showed in the probe.)moq import webrtc --connect, 5 s per run):mainfailed 4 of 8 runs (missing keyframe ×1, timestamp rewind ×3); this branch kept all 8 running.webrtc::tests::a_whep_pull_hides_its_broadcast_until_the_catalog_exists(moq-cli) points the pull at an endpoint that accepts the offer but never answers. It checks that nothing is announced while the session negotiates, nor after the pull fails.session::tests::video_waits_for_its_first_keyframeandlate_frames_are_droppedcover the per-line filter, including PLI pacing on a mocked clock.h264andopusfrom the sink.just checkpasses.just rs test -p moq-cli -p moq-webrtc: 320 passed.client::tests::http_error_redacts_urlnow also checks that a refused dial aborts the catalog.just test interop --all: 209 passed. One case failed:CLI FETCH rust -> rust(group 1 of tail not foundthrough the relay). That is moq-lite FETCH, which this PR does not touch, and it passed whenjust test interopwas rerun.Caused by
Alternatives
MissingKeyframeandTimestampRewindin the bridges by matching on the mux errors, as some TS and FLV paths do. Rejected: the repository forbids matching on errors, and the frame's keyframe flag and timestamp are already known before the bridge sees it.Follow-ups
export rtmp --connectsometimes exits withthe source's clock runs +59.8 ppm off ours, past the 30 ppm the output's may follow, and the WHEP ingest's tracks logtrack::Producer dropped without finish() or abort(). No open decisions.Decisions
Models
Size: S
Implementer: Claude Code, claude-opus-5-5, medium effort
(Written by Claude Opus 5.5 with medium)
Review
Rewritten by
quest reviewafter each round.Head: 7d7ede9
Base: origin/main at 8fbbb2a
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1e927-cb8f-7762-9864-f9c905fe1a21, round 3Score: 10/10,
The incremental change only documents a shutdown follow-up and links it from the roadmap, with no new findings.Rounds: 3; first round 2 (medium 2); findings 2 (medium 2): fixed 2, refuted 0, open 0
Findings: none