From 79c72fa64d6d2a9c6e4a5cbf743c6fd8f89a3165 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 7 Aug 2026 11:37:39 +0200 Subject: [PATCH] =?UTF-8?q?fix(host/audio):=20capture=20endpoints=20carry?= =?UTF-8?q?=20the=20{0.0.1.=E2=80=A6}=20id=20prefix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The capture-direction lookup built its endpoint id with the RENDER prefix {0.0.0.00000000}., but WASAPI's enumeration returns capture ids as {0.0.1.00000000}.{guid} — so the minted microphone's capture side never string-matched the enumeration and the wiring plan paired no recording device (audio-probe plan on the target box: mic_capture = '-'). Measured; IMMDeviceEnumerator::GetDevice tolerated the wrong prefix, which is why the S3 spike's direct open still passed. --- .../src/audio/windows/pad_endpoint.rs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/punktfunk-host/src/audio/windows/pad_endpoint.rs b/crates/punktfunk-host/src/audio/windows/pad_endpoint.rs index 0625ba66..c061d56c 100644 --- a/crates/punktfunk-host/src/audio/windows/pad_endpoint.rs +++ b/crates/punktfunk-host/src/audio/windows/pad_endpoint.rs @@ -97,6 +97,10 @@ const MMDEV_CAPTURE_PATH: &str = r"SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture"; /// WASAPI endpoint-id prefix for render endpoints (`{0.0.0.00000000}.{guid}`). const ENDPOINT_ID_PREFIX: &str = "{0.0.0.00000000}."; +/// …and for CAPTURE endpoints, whose ids carry `{0.0.1.…}` (measured: the enumeration returns +/// this form, and an id built with the render prefix never string-matches it — the minted +/// mic's capture side resolved to nothing until this was split). +const CAPTURE_ENDPOINT_ID_PREFIX: &str = "{0.0.1.00000000}."; /// How long [`ensure`] waits for the new render endpoint to materialise after driver install. const ENDPOINT_WAIT: Duration = Duration::from_secs(10); /// How many times [`ensure`] re-stamps before giving up and asking for an AudioEndpointBuilder @@ -837,17 +841,21 @@ fn install_sss_driver() -> Result<()> { /// The render endpoint owned by `instance_id`, identified through the endpoint store's devnode /// link (`"{1}."` under `…\MMDevices\Audio\Render\{ep}\Properties`). pub(crate) fn find_endpoint_for_devnode(instance_id: &str) -> Result> { - endpoint_for_devnode_in(MMDEV_RENDER_PATH, instance_id) + endpoint_for_devnode_in(MMDEV_RENDER_PATH, ENDPOINT_ID_PREFIX, instance_id) } /// The CAPTURE endpoint owned by `instance_id` — the microphone half of a paired device like -/// the Steam Streaming Microphone. Pad devices are render-only; the `audio-probe` devtest's -/// S3 measurement is what needs this direction. +/// the Steam Streaming Microphone. Pad devices are render-only; the minted-audio provider and +/// the `audio-probe` devtest need this direction. pub(crate) fn find_capture_endpoint_for_devnode(instance_id: &str) -> Result> { - endpoint_for_devnode_in(MMDEV_CAPTURE_PATH, instance_id) + endpoint_for_devnode_in(MMDEV_CAPTURE_PATH, CAPTURE_ENDPOINT_ID_PREFIX, instance_id) } -fn endpoint_for_devnode_in(reg_path: &str, instance_id: &str) -> Result> { +fn endpoint_for_devnode_in( + reg_path: &str, + id_prefix: &str, + instance_id: &str, +) -> Result> { use winreg::enums::HKEY_LOCAL_MACHINE; use winreg::RegKey; let want = format!("{{1}}.{instance_id}"); @@ -862,7 +870,7 @@ fn endpoint_for_devnode_in(reg_path: &str, instance_id: &str) -> Result