Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(audio): align cpal AEC fork build

Louis Beaumontd365f9f9f47b
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 54df57acb..0fb89c776 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -40,16 +40,35 @@ jobs:
run: |
set -euo pipefail
manifest="crates/screenpipe-audio/Cargo.toml"
- expected_url='git = "https://github.com/screenpipe/cpal.git"'
- expected_rev='rev = "1be10a9d67ac7e6b9e0225d2d67ec56058a7dba2"'
+ expected_url='git = "https://github.com/divanshu-go/cpal.git"'
+ expected_branch='branch = "windows-aec"'
+ expected_lock_source='source = "git+https://github.com/divanshu-go/cpal.git?branch=windows-aec#eeae0269bec7b4fc6e21c461624a0fa0e7acdc82"'
cpal_line="$(grep -E '^cpal = ' "$manifest" || true)"
- if [[ "$cpal_line" != *"$expected_url"* || "$cpal_line" != *"$expected_rev"* || "$cpal_line" == *'branch ='* ]]; then
- echo "::error file=${manifest},line=35::cpal pin changed. Run the Windows audio RMS smoke on Win11 24H2 Communications-class hardware before merging, then update this guard with the verified rev."
+ if [[ "$cpal_line" != *"$expected_url"* || "$cpal_line" != *"$expected_branch"* ]]; then
+ echo "::error file=${manifest},line=25::cpal source changed. Run the Windows audio RMS smoke on Win11 24H2 Communications-class hardware before merging, then update this guard with the verified source."
echo "current cpal line: ${cpal_line:-<missing>}"
exit 1
fi
+ cpal_lock_source() {
+ local lockfile="$1"
+ awk '
+ $0 == "[[package]]" { in_package = 1; is_cpal = 0 }
+ in_package && $0 == "name = \"cpal\"" { is_cpal = 1 }
+ in_package && is_cpal && /^source = / { print; exit }
+ ' "$lockfile"
+ }
+
+ for lockfile in Cargo.lock apps/screenpipe-app-tauri/src-tauri/Cargo.lock; do
+ lock_source="$(cpal_lock_source "$lockfile")"
+ if [[ "$lock_source" != "$expected_lock_source" ]]; then
+ echo "::error file=${lockfile}::cpal lock source changed. Run the Windows audio RMS smoke on Win11 24H2 Communications-class hardware before merging, then update this guard with the verified lock source."
+ echo "current cpal lock source: ${lock_source:-<missing>}"
+ exit 1
+ fi
+ done
+
test-ubuntu:
runs-on: ubuntu-latest
env:
diff --git a/Cargo.lock b/Cargo.lock
index 23ff64c2e..ee5ad6d48 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -225,7 +225,7 @@ version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
dependencies = [
- "windows-sys 0.61.2",
+ "windows-sys 0.60.2",
]
[[package]]
@@ -236,7 +236,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
dependencies = [
"anstyle",
"once_cell_polyfill",
- "windows-sys 0.61.2",
+ "windows-sys 0.60.2",
]
[[package]]
@@ -287,7 +287,7 @@ dependencies = [
"objc2-foundation",
"parking_lot",
"percent-encoding",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
"x11rb",
]
@@ -850,7 +850,7 @@ dependencies = [
"bitflags 2.11.1",
"cexpr",
"clang-sys",
- "itertools 0.12.1",
+ "itertools 0.10.5",
"lazy_static",
"lazycell",
"log",
@@ -873,7 +873,7 @@ dependencies = [
"bitflags 2.11.1",
"cexpr",
"clang-sys",
- "itertools 0.12.1",
+ "itertools 0.10.5",
"log",
"prettyplease",
"proc-macro2",
@@ -894,7 +894,7 @@ dependencies = [
"bitflags 2.11.1",
"cexpr",
"clang-sys",
- "itertools 0.12.1",
+ "itertools 0.10.5",
"log",
"prettyplease",
"proc-macro2",
@@ -1355,7 +1355,7 @@ dependencies = [
[[package]]
name = "cidre"
version = "0.15.1"
-source = "git+https://github.com/yury/cidre.git#0b6d10db91a2d6e230f99bd311232773c6e1d525"
+source = "git+https://github.com/yury/cidre.git#b8631d2857e5d039594db7127cf5e3528016af90"
dependencies = [
"cc",
"cidre-macros 0.5.0",
@@ -1510,7 +1510,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [
"lazy_static",
- "windows-sys 0.59.0",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -1721,7 +1721,7 @@ dependencies = [
[[package]]
name = "cpal"
version = "0.15.3"
-source = "git+https://github.com/screenpipe/cpal.git?rev=1be10a9d67ac7e6b9e0225d2d67ec56058a7dba2#1be10a9d67ac7e6b9e0225d2d67ec56058a7dba2"
+source = "git+https://github.com/divanshu-go/cpal.git?branch=windows-aec#eeae0269bec7b4fc6e21c461624a0fa0e7acdc82"
dependencies = [
"alsa",
"cidre 0.15.1",
@@ -2306,7 +2306,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users 0.5.2",
- "windows-sys 0.59.0",
+ "windows-sys 0.60.2",
]
[[package]]
@@ -2624,7 +2624,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -4246,7 +4246,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
dependencies = [
"hermit-abi",
"libc",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -5323,7 +5323,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.60.2",
]
[[package]]
@@ -6768,7 +6768,7 @@ dependencies = [
"once_cell",
"socket2 0.5.10",
"tracing",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -7442,7 +7442,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys 0.4.15",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -7455,7 +7455,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys 0.12.1",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -7534,7 +7534,7 @@ dependencies = [
"security-framework",
"security-framework-sys",
"webpki-root-certs",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -8725,7 +8725,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
dependencies = [
"libc",
- "windows-sys 0.61.2",
+ "windows-sys 0.60.2",
]
[[package]]
@@ -9472,7 +9472,7 @@ dependencies = [
"getrandom 0.4.2",
"once_cell",
"rustix 1.1.4",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -10189,7 +10189,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"
dependencies = [
"memoffset",
"tempfile",
- "windows-sys 0.61.2",
+ "windows-sys 0.60.2",
]
[[package]]
@@ -10924,7 +10924,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.48.0",
]
[[package]]
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index f90c79a5c..554d23671 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -389,7 +389,7 @@ version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
dependencies = [
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -400,7 +400,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
dependencies = [
"anstyle",
"once_cell_polyfill",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -460,7 +460,7 @@ dependencies = [
"objc2-foundation 0.3.2",
"parking_lot",
"percent-encoding",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
"x11rb",
]
@@ -1289,7 +1289,7 @@ dependencies = [
"bitflags 2.11.0",
"cexpr",
"clang-sys",
- "itertools 0.10.5",
+ "itertools 0.12.1",
"log",
"prettyplease",
"proc-macro2",
@@ -1310,7 +1310,7 @@ dependencies = [
"bitflags 2.11.0",
"cexpr",
"clang-sys",
- "itertools 0.10.5",
+ "itertools 0.12.1",
"log",
"prettyplease",
"proc-macro2",
@@ -1919,7 +1919,7 @@ dependencies = [
[[package]]
name = "cidre"
version = "0.15.1"
-source = "git+https://github.com/yury/cidre.git#0b6d10db91a2d6e230f99bd311232773c6e1d525"
+source = "git+https://github.com/yury/cidre.git#b8631d2857e5d039594db7127cf5e3528016af90"
dependencies = [
"cc",
"cidre-macros 0.5.0",
@@ -2103,7 +2103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [
"lazy_static",
- "windows-sys 0.48.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -2442,7 +2442,7 @@ dependencies = [
[[package]]
name = "cpal"
version = "0.15.3"
-source = "git+https://github.com/screenpipe/cpal.git?rev=1be10a9d67ac7e6b9e0225d2d67ec56058a7dba2#1be10a9d67ac7e6b9e0225d2d67ec56058a7dba2"
+source = "git+https://github.com/divanshu-go/cpal.git?branch=windows-aec#eeae0269bec7b4fc6e21c461624a0fa0e7acdc82"
dependencies = [
"alsa",
"cidre 0.15.1",
@@ -3205,7 +3205,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users 0.5.2",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -3634,7 +3634,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -4783,7 +4783,7 @@ dependencies = [
"gobject-sys 0.21.5",
"libc",
"system-deps 7.0.7",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -5940,7 +5940,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
dependencies = [
"hermit-abi",
"libc",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -7460,7 +7460,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -7598,7 +7598,7 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8"
dependencies = [
- "proc-macro-crate 2.0.2",
+ "proc-macro-crate 1.3.1",
"proc-macro2",
"quote",
"syn 2.0.117",
@@ -8363,7 +8363,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
dependencies = [
"libc",
- "windows-sys 0.48.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -9401,7 +9401,7 @@ dependencies = [
"once_cell",
"socket2 0.5.10",
"tracing",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -10223,7 +10223,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys 0.4.15",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -10236,7 +10236,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys 0.12.1",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -10324,7 +10324,7 @@ dependencies = [
"security-framework",
"security-framework-sys",
"webpki-root-certs",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -11926,7 +11926,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
dependencies = [
"libc",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -12341,6 +12341,7 @@ dependencies = [
"cfg-if 1.0.4",
"libc",
"psm",
+ "windows-sys 0.52.0",
"windows-sys 0.59.0",
]
@@ -13547,7 +13548,7 @@ dependencies = [
"getrandom 0.4.2",
"once_cell",
"rustix 1.1.4",
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -14357,7 +14358,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"
dependencies = [
"memoffset",
"tempfile",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -15339,7 +15340,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
- "windows-sys 0.48.0",
+ "windows-sys 0.52.0",
]
[[package]]
diff --git a/crates/screenpipe-audio/Cargo.toml b/crates/screenpipe-audio/Cargo.toml
index 6c86f1bf8..6124e5680 100644
--- a/crates/screenpipe-audio/Cargo.toml
+++ b/crates/screenpipe-audio/Cargo.toml
@@ -18,20 +18,10 @@ serde_json = "1.0"
oasgen = { workspace = true }
# Cross-platform audio capture.
-# Pinned to screenpipe/cpal@1be10a9d (cpal 0.15.3) — the rev we ran
-# in production for months prior to the May 7 fork swap (PR #3257).
-# That swap brought in cpal 0.18 via divanshu-go/screenpipe-cpal,
-# which inherited cpal upstream PR #1097's WASAPI AUTOCONVERTPCM
-# changes. On Windows 11 24H2 those changes cause Communications-class
-# USB mics to deliver silent capture (Jabra Evolve 75, Logi C270 HD,
-# etc.) — same mic records normal speech via DirectShow at -3 dB
-# peak but at -85 dB via WASAPI. See:
-# https://github.com/RustAudio/cpal/issues/1200
-#
-# Tradeoff: we lose the divanshu fork's macOS Voice Processing I/O
-# AEC feature (added 2026-05-06). It hasn't been wired into a user-
-# visible toggle yet, so reverting is no-op for end users while
-# restoring Windows capture across the board.
+# Use the divanshu-go Windows AEC fork so Windows microphone AEC can be
+# wired through screenpipe's capture path. Cargo.lock pins the resolved
+# commit; update the cpal guard in .github/workflows/ci.yml whenever this
+# dependency is intentionally advanced.
cpal = { git = "https://github.com/divanshu-go/cpal.git", branch = "windows-aec" }
# Wav encoding
diff --git a/crates/screenpipe-audio/src/core/stream.rs b/crates/screenpipe-audio/src/core/stream.rs
index 84805fa75..a5da937cd 100644
--- a/crates/screenpipe-audio/src/core/stream.rs
+++ b/crates/screenpipe-audio/src/core/stream.rs
@@ -7,10 +7,9 @@ use anyhow::anyhow;
use anyhow::Result;
#[cfg(not(all(target_os = "linux", feature = "pulseaudio")))]
use cpal::traits::{DeviceTrait, StreamTrait};
-// cpal 0.15.3 (the rev we're pinned to in Cargo.toml — see comment
-// there for why) names its error type `StreamError`. cpal 0.18
-// renamed it to `Error`. We alias to `CpalError` here so call sites
-// don't carry the version-specific name.
+// The current cpal 0.15-compatible fork names its error type
+// `StreamError`. cpal 0.18 renamed it to `Error`. We alias to
+// `CpalError` here so call sites don't carry the version-specific name.
#[cfg(not(all(target_os = "linux", feature = "pulseaudio")))]
use cpal::StreamError as CpalError;
use std::sync::atomic::{AtomicBool, Ordering};
@@ -564,6 +563,7 @@ fn build_input_stream(
},
error_callback,
None,
+ None,
)
.map_err(|e| anyhow!(e)),
cpal::SampleFormat::I16 => device
@@ -576,6 +576,7 @@ fn build_input_stream(
},
error_callback,
None,
+ None,
)
.map_err(|e| anyhow!(e)),
cpal::SampleFormat::I32 => device
@@ -591,6 +592,7 @@ fn build_input_stream(
},
error_callback,
None,
+ None,
)
.map_err(|e| anyhow!(e)),
cpal::SampleFormat::I8 => device
@@ -603,6 +605,7 @@ fn build_input_stream(
},
error_callback,
None,
+ None,
)
.map_err(|e| anyhow!(e)),
_ => Err(anyhow!(
@@ -617,6 +620,7 @@ fn cpal_stream_config(
config: &cpal::SupportedStreamConfig,
#[cfg_attr(not(target_os = "windows"), allow(unused_variables))] windows_input_aec: bool,
) -> cpal::StreamConfig {
+ #[cfg_attr(not(target_os = "windows"), allow(unused_mut))]
let mut stream_config = config.config();
#[cfg(target_os = "windows")]
{