Skip to content

feat(moq-cli)!: capture encodes while publishing, --on-demand as an opt-in - #7188

Merged
kixelated merged 3 commits into
mainfrom
quest/m1/eager-encode/cli
Oct 29, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m1/eager-encode/cli

Conversation

@kixelated

@kixelated kixelated commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Completes quest/m1/eager-encode/cli.md (removed here, along with its link in the epic README).

Summary

  • moq import capture follows the library defaults: the camera and microphone stay open and encode for the whole publish, so a late subscriber or FETCH finds the recent past.
  • New --on-demand flag sets moq_video::encode::Capture::on_demand and moq_audio::encode::Capture::on_demand, which opens and encodes each source only while its track has a subscriber (the old behavior).
  • Audio is now built as a moq_audio::encode::Capture by CaptureArgs::audio_capture, the same way video_capture builds the video side, so the (config, options) tuple in Source::Capture is gone.
  • doc/bin/cli.md describes the always-on camera and microphone, and adds an --on-demand example.

Impact

Choices made without asking

  • Flag name --on-demand: the quest's Goal names it. It mirrors the library field on_demand, following AGENTS.md's "Mirror names across Rust, JS, and the bindings". The Plan's "the repository's CLI rule" doesn't point at a specific rule I could find; the closest are the AGENTS.md CLI-examples rule (checked: the only invocations are in doc/bin/cli.md, and the new one matches --help) and rs/AGENTS.md's rename rule (doesn't apply, since nothing is renamed). Suggested quest wording: "Name the flag --on-demand, mirroring Capture::on_demand."
  • One flag for both media: it covers video and audio together, not --video-on-demand/--audio-on-demand. The Goal describes a single switch.
  • Marked !: this PR only adds the flag, but moq-cli's changelog wouldn't otherwise record its default change, because the library PRs didn't touch the crate.
  • Test scope: capture_runs_always_unless_on_demand checks that the default maps to both libraries' always-on option and that --on-demand maps to their opt-in. The "publishes without a subscriber" behavior needs a real device at the CLI level. The libraries' own tests cover it on synthetic devices (moq-audio on_demand_waits_for_a_subscriber and its always-on counterpart, and the moq-video producer tests).

Checks

  • just rs test -p moq-cli --features capture: 235 passed.
  • cargo clippy -p moq-cli --all-targets --features capture -D warnings: clean.
  • cargo fmt --check: clean.
  • quest check --base origin/main: ok.
  • moq import capture --help lists --on-demand.

Follow-ups

  • When raw audio on demand lands, audio goes back to on demand by default. Re-check the --on-demand help text and doc/bin/cli.md then, since "the microphone stays open" will no longer hold.

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

kixelated and others added 2 commits October 28, 2026 20:49
…pt-in

`import capture` follows the moq-video and moq-audio defaults, keeping the
camera and microphone open and encoding for the whole publish so a late
subscriber can fetch the recent past. `--on-demand` selects both libraries'
`Capture::on_demand`, opening each source only while its track has a
subscriber.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title moq-cli capture encodes always unless --on-demand feat(moq-cli)!: capture encodes while publishing, --on-demand as an opt-in Oct 29, 2026
@kixelated
kixelated marked this pull request as ready for review October 29, 2026 03:53
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 13 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b3227b55-9240-48e6-9de3-9cddd3c21e34
Commits

Reviewing files that changed from the base of the PR and between f94ae72 and e0c6ba1.

Files selected for processing: 4
  • doc/bin/cli.md
  • quest/m1/eager-encode/README.md
  • quest/m1/eager-encode/cli.md
  • rs/moq-cli/src/publish.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T04:00:12.436281Z e0c6ba1 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed commit: 9462f89

No actionable implementation bugs found. The flag reaches both libraries' Capture::on_demand fields, and constructing audio Capture alongside video preserves its existing configuration and publication path. This is a small, appropriate CLI layer over the library policy; the parser-to-options regression covers both defaults and opt-in.

Documentation clarification: --on-demand gates sustained capture, not all device access. The video driver still opens the source once at startup to probe its negotiated mode before releasing it until a viewer arrives (rs/moq-video/src/encode/producer.rs, Driver::run). Qualify the new “open ... only while ... a subscriber” help/doc wording so users do not interpret it as preventing the initial camera/picker/permission probe.

Verification: static inspection of argument mapping, feature-gated publication and both library demand gates. I did not run tests, builds, or physical-device checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

kixelated commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Applied the automated review's documentation note in e0c6ba1. The --on-demand help text and doc/bin/cli.md now say that video still opens its source once at startup to probe the negotiated mode, and only sustained capture and encode wait for a subscriber.

(Written by Claude Opus 5.5)

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed commit: e0c6ba1

The prior device-access documentation clarification is addressed: both --on-demand help and doc/bin/cli.md explicitly retain video's startup mode probe while describing demand-gated capture. No new actionable bugs found in this documentation-only delta from 9462f89; implementation is unchanged.

Direction: this accurately distinguishes the opt-in's steady-state behavior from startup device access. Verification: static comparison against the previously inspected video driver; tests, builds and hardware checks were not run.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Landing e0c6ba1 as is, per the maintainer's approval of the choices in the PR body: one --on-demand flag for both audio and video, named after Capture::on_demand, and the PR marked breaking.

  • Reviews: the OpenAI review and the Codex review of this head found nothing; the earlier documentation note was addressed in this head.
  • Checks: all 10 required checks pass.
  • quest check against main (bd299e7): ok; this PR deletes quest/m1/eager-encode/cli.md and its epic link.

Follow-up already in the body: re-check the --on-demand help text and doc/bin/cli.md when raw audio on demand lands.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 97387af Oct 29, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m1/eager-encode/cli branch October 29, 2026 04:34
kixelated added a commit that referenced this pull request Oct 31, 2026
Resolves capture against main's always-on capture (#7188, #7164): the
audio source is now moq_audio::encode::Capture, with_report also arms
the TS republish, and the video loop reports the ceiling when an
unwatched encoder rests back to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant