From 7ae9b6624585863a2ecf8bffd2f144f34603e0b3 Mon Sep 17 00:00:00 2001 From: WeirdTreeThing Date: Tue, 15 Aug 2023 23:07:19 -0400 Subject: [PATCH] Increase alsa headroom when using pipewire Pipewire sets the period_size very low by default, which causes instability with the drivers locking up. Increase the headroom to work around this. Pulseaudio sets it higher by default so it is not needed there. Also re-word the status print for avs_dmic. --- conf/common/51-increase-headroom.lua | 12 ++++++++++++ setup-audio | 9 ++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 conf/common/51-increase-headroom.lua diff --git a/conf/common/51-increase-headroom.lua b/conf/common/51-increase-headroom.lua new file mode 100644 index 0000000..3f79698 --- /dev/null +++ b/conf/common/51-increase-headroom.lua @@ -0,0 +1,12 @@ +rule = { + matches = { + { + { "node.name", "matches", "alsa_output.*" }, + }, + }, + apply_properties = { + ["api.alsa.headroom"] = 4096, + }, +} + +table.insert(alsa_monitor.rules,rule) diff --git a/setup-audio b/setup-audio index 2b9649d..e314f1c 100755 --- a/setup-audio +++ b/setup-audio @@ -70,7 +70,7 @@ def avs_audio(board, username): # Install wireplumber config for dmic if wireplumber is installed on the system if path_exists("/usr/bin/wireplumber"): - print_status("Installing wireplumber config (fixes internal mic)") + print_status("Forcing avs_dmic to use S16LE format") mkdir("/etc/wireplumber/main.lua.d/", create_parents=True) cpfile("conf/avs/51-avs-dmic.lua", "/etc/wireplumber/main.lua.d/51-avs-dmic.lua") @@ -290,4 +290,11 @@ if __name__ == "__main__": print_error(f"Unknown/Unsupported chromebook model: {device_board}") exit(1) + # Install wireplumber config to increase headroom + # fixes instability and crashes on various devices + if path_exists("/usr/bin/wireplumber"): + print_status("Increasing alsa headroom (fixes instability)") + mkdir("/etc/wireplumber/main.lua.d/", create_parents=True) + cpfile("conf/common/51-increase-headroom.lua", "/etc/wireplumber/main.lua.d/51-increase-headroom.lua") + print_header("Audio installed successfully! Reboot to finish setup.")