Bluetooth mic startup: honest Listening indicator, startup-time investigation

The bar turned green after 2 s on a timer even when the microphone delivered
nothing. It now turns green only on real audio: RMS above 0.0005, or three
consecutive chunks that are not digital silence (the virtual mic emits one
stray nonzero chunk right after start, and a Bluetooth headset's floor ramps
in from a few LSB). Measured 1.2-1.4 s after the key, within 0.14 s of the
first real samples.

diagnostics/bluetooth/ records how startup went from ~1.6 s (or never) to
~1.1-1.4 s: a btusb driver bug, two PipeWire bluez5 bugs, a 500 ms WirePlumber
switch timeout and an over-broad auto-connect rule. Those fixes are machine
level and live outside this repo; the patches, tools and measurements are here.
STARTUP-TIME.md is the summary and explains the ~0.9 s hardware floor.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xoc9DJCViR7dg9eKzzAcfQ
This commit is contained in:
2026-09-09 11:58:16 +01:00
parent e5020d24fe
commit 6f7f7ddd6c
14 changed files with 5742 additions and 3 deletions
@@ -0,0 +1,13 @@
--- a/spa/plugins/bluez5/backend-native.c
+++ b/spa/plugins/bluez5/backend-native.c
@@ -2835,6 +2835,11 @@
if (td->err != -EINPROGRESS)
sco_ready(t);
+ else
+ /* A second node can acquire the same transport while connect() is
+ * pending. Do not let it re-emit an error from the previous attempt.
+ */
+ spa_bt_transport_set_state(t, SPA_BT_TRANSPORT_STATE_PENDING);
return 0;