Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/bin/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ moq --client-connect https://relay.example.com/anon --broadcast conference.hang
```

Video decoding prefers the platform hardware backend and falls back to the
built-in software H.264 decoder. Rendering uses Metal on macOS, D3D12 on
Windows, and Vulkan or OpenGL on Linux. Audio uses the system default output
device through CoreAudio, WASAPI, or ALSA.
built-in software H.264 decoder. Rendering picks the best graphics API the
machine offers: Metal on macOS, and Vulkan ahead of D3D12 or OpenGL elsewhere.
Audio uses the system default output device through CoreAudio, WASAPI, or ALSA.

### Publish a Video File

Expand Down
2 changes: 1 addition & 1 deletion rs/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Then `Config::load()?` (initializes tracing), build clients/servers via `.init()

- **Local checks only compile the host's platform and target, and PR CI is Linux-only.** `#[cfg(target_os = "...")]` code for other platforms is invisible to them, and `cargo fmt` skips those modules too. Windows and Mac runners cost too much for a per-PR gate, so those platforms are manual:

- Windows (moq-video's Media Foundation and D3D11 backends): `just rs windows`, which must run ON Windows. You can't reproduce it elsewhere, since cross-compiling dies in openh264-sys2's vendored C++.
- Windows (moq-video's Media Foundation and D3D11 backends): `just rs windows`, which must run ON Windows. You can't reproduce it elsewhere, since cross-compiling dies in openh264-sys2's vendored C++. It names `moq-cli/play` explicitly, since that feature is what pulls in moq-video's wgpu renderer and moq-audio's cpal output; a default-feature build compiles neither.
- macOS (moq-video's VideoToolbox and ScreenCaptureKit, moq-audio's system audio): `just rs macos`, which must run ON macOS. Scoped to moq-video + moq-audio, and needs `--all-features` because moq-audio's capture backend is off by default.
- Linux: covered. `just rs ci` already runs `--all-features` in a dev shell carrying PipeWire and ALSA. VAAPI loads libva dynamically, so nvenc/nvdec/vaapi/pipewire all compile without libva installed.
- wasm32 (moq-wasm): `just rs wasm`. The crate root is `#![cfg(target_arch = "wasm32")]`, so a host-target `cargo check --workspace` compiles it down to nothing and sees no errors at all. This one needs no special host (the Nix shell carries the target), so `just rs ci` and `just check-all` both run it, and `just check` adds it when the diff touches `rs/moq-wasm/`. It's a compile gate, distinct from the root `just wasm`, which builds the shippable `@moq/wasm` package.
Expand Down
6 changes: 5 additions & 1 deletion rs/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,14 @@ fix-changed $FILES:
# backend don't build on MSVC, while moq-video's Linux-only nvenc/nvdec defaults
# are already no-ops off Linux. moq-gst is excluded because it links
# GStreamer via pkg-config, which the Windows runner doesn't have.
#
# `moq-cli/play` is named explicitly because it's off by default and is what
# turns on moq-video's wgpu renderer and moq-audio's cpal output, neither of
# which any default-feature build compiles.

# Compile the whole workspace on a Windows host. Must run ON Windows.
windows *args:
cargo check --workspace --exclude moq-gst --all-targets {{ args }}
cargo check --workspace --exclude moq-gst --all-targets --features moq-cli/play {{ args }}

# Runs the `#[cfg(target_os = "macos")]` code past the compiler: moq-video's
# VideoToolbox encode/decode and its ScreenCaptureKit / AVFoundation capture,
Expand Down
40 changes: 40 additions & 0 deletions rs/moq-audio/src/decode/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,44 @@ mod tests {
assert_eq!(pair[0], pair[1]);
}
}

#[tokio::test]
async fn reads_the_container_the_catalog_declares() {
let mut broadcast = moq_net::broadcast::Info::new().produce();
let track = broadcast.create_track("audio", hang::container::track_info()).unwrap();
let subscriber = broadcast.consume();

let mut catalog = hang::catalog::AudioConfig::new(hang::catalog::AudioCodec::Pcm, 48_000, 1);
catalog.container = hang::catalog::Container::Loc;

let mut producer = moq_mux::container::Producer::new(track, moq_mux::catalog::hang::Container::Loc);
let mut consumer = Consumer::new(
&subscriber,
&catalog,
"audio",
Config {
format: Format::F32,
..Config::new()
},
)
.await
.unwrap();

let samples = [0.25f32, -0.5, 0.75, -1.0];
let payload: Vec<u8> = samples.iter().flat_map(|sample| sample.to_le_bytes()).collect();
producer
.write(moq_mux::container::Frame {
timestamp: Timestamp::ZERO,
duration: None,
payload: payload.into(),
keyframe: true,
})
.unwrap();

let frame = consumer.read().await.unwrap().expect("decoded frame");
assert_eq!(
Format::F32.as_interleaved_f32(&frame.data, 1).unwrap().as_ref(),
samples
);
}
}
5 changes: 4 additions & 1 deletion rs/moq-audio/src/playback.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! Play decoded PCM out a speaker, via [`cpal`] (CoreAudio / WASAPI / ALSA).
//!
//! The playback counterpart to [`capture`](crate::capture), and where a
//! The playback counterpart to `capture`, and where a
// `capture` is deliberately not a doc link: the module is behind the
// off-by-default `capture` feature, so a link to it fails the `-D warnings`
// rustdoc build of a playback-only build (what `moq-cli`'s `play` enables).
//! [`decode::Consumer`](crate::decode::Consumer) ends up:
//!
//! ```no_run
Expand Down
Loading