Windows port Phase 1: real cpal/WASAPI audio backend #3
Open
mollusk
wants to merge 1 commits from
windows-port-phase1 into windows-port-phase0
pull from: windows-port-phase1
merge into: :windows-port-phase0
:main
:codex-win-audio-probe
:s2-host-fault
:phase-0b-teardown
:phase1-ownership-tagging
:connection-transparency
:screenshare-advanced-controls
:codex-a6-playback-handoff
:codex-0.6.2-refinements
:codex-playlist-drawer-ui
:w22-music-phase1
:w22-image-lightbox
:release/0.5.1
:feat/clip-volume
:codex-presence-ratelimit-QUARANTINE
:codex-inline-audio-player
:codex-w16-settings-ui
:codex-wishlist-ayu-themes
:w16-custom-backgrounds
:reconnect-resilience
:windows-port-phase2
:windows-port-phase1
:windows-port-phase0
:ci-cargo-deny
:codex-security-s8-audio-membership
:codex-security-s11-presence-discovery
:codex-security-hardening
:codex-home-empty-state-ui
:codex-settings-category-nav
:codex-security-s9
:codex-wishlist-audio-hotkeys
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
47c58047ce |
Windows port Phase 1: real cpal/WASAPI audio backend
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> |