Repository navigation
Conversation
[Medium impact] The PR appears safe to merge, with a non-blocking gap in preserving custom rate settings. Findings
SummaryAdds a PipeWire default that allows 44.1, 48, 88.2, and 96 kHz, plus a migration that saves the setting and applies it without restarting PipeWire.
Reviews (5) · Last reviewed commit: "Let PipeWire follow the source's sample ..." · Reviewed by Greptile |
Ship a PipeWire drop-in that allows 44.1, 48, 88.2 and 96 kHz, so a stream starting on an idle device plays at its own rate instead of being resampled to 48 kHz. Rates the hardware can't do still resample, as today. The migration installs the drop-in for existing users and applies the same list to the running graph through pw-metadata, so it takes effect without restarting PipeWire. Anyone who already set allowed-rates is left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e25787a to
8851c53
Compare
| grep -qsE '^[[:space:]]*default\.clock\.allowed-rates' \ | ||
| "$config_root/pipewire/pipewire.conf" "$config_root"/pipewire/pipewire.conf.d/*.conf \ | ||
| "$system/pipewire.conf" "$system"/pipewire.conf.d/*.conf |
There was a problem hiding this comment.
One-line settings get overwritten
If a user writes context.properties = { default.clock.allowed-rates = [ 48000 ] } on one line, this check misses their valid setting. It only matches lines that start with default.clock.allowed-rates after whitespace. The migration then installs its own list and replaces the running setting through pw-metadata, despite promising to preserve chosen rates.
Read the merged properties instead of relying on where the key appears on a line.
Knowledge Base Used: Migration framework
What changes
PipeWire's
clock.allowed-ratesis[ 48000 ]on a stock install, so every 44.1 kHz track and every 88.2/96 kHz recording is resampled on its way to the device. On macOS, CoreAudio follows the source's rate.config/pipewire/pipewire.conf.d/10-sample-rates.confsetsdefault.clock.allowed-rates = [ 44100 48000 88200 96000 ]. When a stream starts on an idle device, PipeWire switches the device to the stream's rate if the hardware supports it; otherwise it resamples as today. 48 kHz sources are unaffected.${XDG_CONFIG_HOME:-$HOME/.config}and sets the same list on the running graph withpw-metadata, since PipeWire readsconf.donly at startup. Nothing restarts and playback isn't interrupted. Anyone who already setallowed-ratesin a user or/etc/pipewireconfig is left alone.The list is the one PipeWire ships, disabled, as
/usr/share/pipewire/pipewire.conf.avail/10-rates.conf. Its docs say it is off by default "because of various kernel and Bluetooth issues", and #10534 lists pops on a rate switch with some Bluetooth, HDMI and cheap USB devices as the reason to keep it opt-in. I haven't hit that on the output below, but it is the only one I've tested. Screen recordings keep their fixed 48 kHz from #11092.Refs #10534 (the rate half; the soft-mixer half is separate). Step one of #13832, rebuilt from the closed #13834.
Verification
On Omarchy 4.0.4, PipeWire 1.6.8, Intel HDA HDMI output, I played a 44.1 kHz file with
pw-playbefore and after the migration and readpw-top:The device itself switched to 44100, so the stream is no longer resampled.
pw-config --name pipewire.conf merge context.propertiesreported the drop-in's list, so it holds after a restart.The migration, run with
bash -euo pipefailagainst a scratchHOMEandPIPEWIRE_CONFIG_DIRwithpw-metadatastubbed: installs and sets the rates on a fresh home and under a customXDG_CONFIG_HOME; does nothing on a second run, or when the rates are already set in~/.config/pipewireor/etc/pipewire; still installs when the only setting is commented out; exits 0 when PipeWire isn't running.shellcheckis clean. No test added: config values and migrations don't get one.Not checked: USB DACs, Bluetooth outputs, and hardware that can't do 44.1 kHz.
Screenshots
No visible change: this only changes PipeWire's sample-rate selection.
🤖 Generated with Claude Code