feat(moq-audio)!: let publish_capture carry a catalog extension - #3356
Conversation
`encode::Producer` is already generic over `CatalogExt`, but `Publication` and `publish_capture` hardcode the default, so the turnkey path is closed to any consumer whose catalog carries an extension. Reaching it meant driving the capture and the encoder by hand, for no reason other than the signature. Thread the parameter through `Publication::new`, `build`, `Driver`, `Track` and `EncoderOutput`. BREAKING CHANGE: `Driver` is now `Driver<E: CatalogExt = ()>`. The parameter defaults, so a caller that writes `Driver` keeps compiling, but one that names the type in a struct field, a function signature or an impl without the default will need `Driver<()>`.
…dev#3356) Squashed from `pr/audio-catalog-ext` at f71136a, open as moq-dev#3356.
|
Warning Review limit reachedNext included review available in 24 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@coderabbitai review (written by Claude Opus 5) |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- PR metadata ---'
gh pr view 3356 --repo moq-dev/moq --json number,title,baseRefName,headRefName,files,commits
printf '%s\n' '--- Changed files and diff ---'
gh pr diff 3356 --repo moq-dev/moq --color=never
printf '%s\n' '--- Rust source outlines for likely affected files ---'
fd -e rs . | while IFS= read -r file; do
if rg -q '\b(Publication|Driver|EncoderOutput|publish_capture|CatalogExt)\b' "$file"; then
echo "### $file"
ast-grep outline "$file" --items all --type struct,impl,function,type --match 'Publication|Driver|EncoderOutput|publish_capture|CatalogExt' || true
fi
doneLength of output: 11673 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- capture publication and driver paths ---'
sed -n '160,390p' rs/moq-audio/src/encode/capture.rs
sed -n '390,735p' rs/moq-audio/src/encode/capture.rs
sed -n '780,900p' rs/moq-audio/src/encode/capture.rs
printf '%s\n' '--- audio producer and reservation definitions ---'
sed -n '1,280p' rs/moq-audio/src/encode/producer.rs
printf '%s\n' '--- Catalog extension trait and catalog producer ---'
sed -n '1,240p' rs/moq-mux/src/catalog/hang/ext.rs
sed -n '1,240p' rs/moq-mux/src/catalog/producer.rs
printf '%s\n' '--- Public API uses and type annotations ---'
rg -n --type rust -C 4 \
'\b(Publication::new|publish_capture\s*\(|Driver(?:\s*<[^>]*>)?\b)' \
rs
printf '%s\n' '--- Generic catalog producer construction and audio/video capture parity ---'
rg -n --type rust -C 4 \
'\bmoq_mux::catalog::Producer(?:\s*<[^>]*>)?\b|\bpublish_capture\s*\(' \
rs/moq-audio rs/moq-video rs/moq-cliLength of output: 110611
The You are interacting with an AI system. |
encode::Produceris already generic overCatalogExt, butPublicationandpublish_capturehardcode the default, so the turnkey capture path is closed to any consumer whose catalog carries an extension. Reaching it meant driving the capture and the encoder by hand, for no reason other than the signature.This PR is part of a series to update iroh-live to latest moq, see n0-computer/iroh-live#45. The code and this description were written by Claude Code.
Summary
Threads the parameter through
Publication::new,build,Driver,TrackandEncoderOutput, which is every type between the entry point and the producer that already had it.The video side has never had this problem:
moq_video::encode::publish_capturetakes the catalog producer whole. This brings the audio side level with it.Breaking changes
DriverbecomesDriver<E: CatalogExt = ()>.The parameter defaults, so nothing that writes
Driverin an expression position changes, and no call toPublication::neworpublish_capturechanges: the extension is inferred from the catalog producer passed in. What breaks is naming the type without the default, which is a struct field, a function signature, or an impl header holding aDriver. Those becomeDriver<()>.We hit exactly one such site downstream and it was a one-word change.
Test plan
cargo check -p moq-audio --all-featuresandcargo clippy --all-targets, clean.cargo test -p moq-audio: 72 pass.publish_capture, which is the case that motivated this.Note on rebasing
This was written before #3337 reworked
Publicationto outlive a missing input, and has been re-applied on top of that design rather than merged with the old one: the retry, theReservedregistration andStatus::Startingare all upstream's, and this only adds the type parameter to them.