Replace the Phase 0 no-op CpalBackend stub with a working cpal backend (WASAPI on Windows), preserving the exact PipeWire AudioBackend contract so the mixer/encoder/jitter pipeline is unchanged. - Capture: input stream -> downmix to mono -> 960-sample (20ms) i16 frames -> tx, matching the encoder/jitter frame size. - Playback: 200ms stereo ring prefilled to PLAYBACK_TARGET_SAMPLES; the output callback drains it (silence on underrun) while the owning thread feeds it from rx. ring_fill is the exact delta-maintained occupancy counter (fetch_add on push, fetch_sub on pop), preserving the clock-paced production design (not ringbuf's stale occupied_len). - cpal::Stream is !Send, but AudioBackend is Send+Sync and shared via Arc, so each stream lives on its own owning thread (built/played/dropped there); the struct holds only the running flag + JoinHandle. stop() flips the flag and joins. - Generic over F32/I16/U16 sample formats; device selected by name else default; requires a native 48kHz config (clear error otherwise, no resampling yet). Mirrors the PipeWire drain_loop and playout-health line. - Cargo.toml: add cpal 0.15 under cfg(windows). Verified by temporarily compiling cpal_impl against real cpal on Linux/ALSA: build + clippy clean, 6/6 cpal_impl unit tests pass. Reverted to windows-only gating; shipped Linux state green (316/316). Runtime/WASAPI end-to-end is unverified and pending a Windows host (plan M2). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
67 lines
2.3 KiB
TOML
67 lines
2.3 KiB
TOML
[package]
|
|
name = "peerspeak"
|
|
version = "0.2.0"
|
|
edition = "2024"
|
|
# Application crate, not a crates.io library — refuse `cargo publish` and let
|
|
# cargo-deny's [licenses.private] skip the missing-license check.
|
|
publish = false
|
|
|
|
[lib]
|
|
name = "peerspeak"
|
|
path = "src/lib.rs"
|
|
|
|
[[bin]]
|
|
name = "peerspeak"
|
|
path = "src/main.rs"
|
|
|
|
[[bin]]
|
|
name = "test_net"
|
|
path = "src/bin/test_net.rs"
|
|
|
|
[[bin]]
|
|
name = "specview"
|
|
path = "src/bin/specview.rs"
|
|
|
|
[dependencies]
|
|
anyhow = "1.0.102"
|
|
async-trait = "0.1.89"
|
|
base64 = "0.22.1"
|
|
bytes = "1.11.1"
|
|
dirs = "6.0.0"
|
|
iced = { version = "0.14.0", features = ["canvas", "image"] }
|
|
# W4 custom avatars: decode/resize an arbitrary user image (png/jpeg only to keep
|
|
# the codec surface small). The matching native file picker (`rfd`) is platform-
|
|
# gated below — its backend differs per OS (xdg-portal on Linux, Win32 on Windows).
|
|
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
|
|
iroh = "1.0.0-rc.0"
|
|
iroh-gossip = "0.99.0"
|
|
opus = "0.3.1"
|
|
rand = "0.10.1"
|
|
ringbuf = "0.5.0"
|
|
serde = { version = "1.0.228", features = ["derive"] }
|
|
serde_json = "1.0.150"
|
|
thiserror = "2.0.18"
|
|
tokio = { version = "1.52.3", features = ["full"] }
|
|
tokio-stream = "0.1.18"
|
|
|
|
# --- Platform-specific dependencies -----------------------------------------
|
|
# Audio and the native file-picker backends differ per OS. Everything else in the
|
|
# app talks to the `AudioBackend` trait and the `PlatformAudioBackend` alias (see
|
|
# `src/audio/mod.rs`), so platform selection is confined to these few lines.
|
|
|
|
[target.'cfg(unix)'.dependencies]
|
|
# Linux audio backend. v0_3_49 exposes `Buffer::requested()` (the graph's per-cycle
|
|
# quantum), used by the playback RT callback to fill exactly what the device asks
|
|
# for instead of a hard-coded 1024-frame quantum (crackle on non-1024 hardware).
|
|
# The field has existed in libpipewire since 0.3.49 (2022).
|
|
pipewire = { version = "0.9", features = ["v0_3_49"] }
|
|
# Native file picker via the XDG desktop portal (no GTK) on Linux.
|
|
rfd = { version = "0.17", default-features = false, features = ["xdg-portal"] }
|
|
|
|
[target.'cfg(windows)'.dependencies]
|
|
# Native file picker using the built-in Win32 dialog backend on Windows.
|
|
rfd = { version = "0.17", default-features = false }
|
|
# Windows audio backend: cpal drives WASAPI for capture/playback behind the
|
|
# AudioBackend trait (src/audio/cpal_impl.rs). The Linux counterpart is pipewire.
|
|
cpal = "0.15"
|