Switching to filter chain and back causes very high CPU usage, xruns
Version, Distribution, Desktop Environment: 0.3.37, Gentoo Linux, Xfce4
Description of Problem:
This is a weird one :) I have a filter chain node connected to USB speakers. The latter are also the fallback sink.
Switching a stream to the filter sink works fine. Switching that stream back to the fallback sink however will raise CPU load inside the filter chain process considerably and stay there.
If the filter chain is complex (using more CPU than available during the course of this bug), it will reach a point of no return and cause buffer xruns.
The following settings should be of note: default.clock.rate=96000
, api.alsa.period-size=128
, api.alsa.disable-batch=true
. However, since the issue does not happen until switching back from the filter chain, I suspect a bug rather than these settings to be responsible.
How Reproducible: 100%
Steps to Reproduce:
- (Use the three settings mentioned above)
- Set an USB device as the fallback sink
- Load the filter chain pasted below
- Start playback of something
- -> filter chain process uses 2-3% CPU ((why?? it's got no input))
- Move playback stream to filter chain with pavucontrol
- -> filter chain process uses 2-3% ✓
- Move playback stream back to fallback sink with pavucontrol
- -> filter chain process slowly starts using more and more CPU
☠
Additional Info:
In the following, the offending filter chain is called sc203_equalizer.
pw-dump3.txt (after bug was triggered)
pw-top when triggered:
S ID QUANT RATE WAIT BUSY W/Q B/Q ERR NAME
! 28 0 0 0.0µs 0.0µs 0.00 0.00 0 Dummy-Driver
! 29 0 0 0.0µs 0.0µs 0.00 0.00 0 Freewheel-Driver
! 38 0 0 0.0µs 0.0µs 0.00 0.00 0 Midi-Bridge
! 43 0 0 0.0µs 0.0µs 0.00 0.00 0 v4l2_input.pci-0000_00_14.0-usb-0_8_1.0
! 45 0 0 0.0µs 0.0µs 0.00 0.00 0 v4l2_input.pci-0000_00_14.0-usb-0_8_1.2
! 47 0 0 0.0µs 0.0µs 0.00 0.00 0 alsa_output.pci-0000_01_00.1.hdmi-stereo
48 1024 96000 15.9ms 34.7µs 1.49 0.00 4970 alsa_output.usb-EVE_SC203_Speaker-00.analog-stereo
77 0 0 85.3µs 851.5µs 0.01 0.08 4971 + sc203_dedrone
74 0 0 68.3µs 20.8µs 0.01 0.00 4971 + sc203_dedrone
80 1 25 231.0µs 43.2µs 0.02 0.00 4971 + PulseAudio Volume Control
112 0 0 63.4µs 12.1ms 0.01 1.13 5173 + sc203_equalizer
118 0 0 38.0µs 21.3µs 0.00 0.00 4970 + sc203_equalizer
105 1 25 197.0µs 35.3µs 0.02 0.00 4971 + PulseAudio Volume Control
115 827 44100 44.4µs 271.6µs 0.00 0.03 4971 + Firefox
125 1 25 71.5µs 8.5µs 0.01 0.00 4971 + PulseAudio Volume Control
! 49 0 0 0.0µs 0.0µs 0.00 0.00 0 alsa_output.pci-0000_00_1f.3.analog-stereo
50 1024 96000 134.0µs 1.7µs 0.01 0.00 3 alsa_input.pci-0000_00_1f.3.analog-stereo
65 1 25 65.1µs 10.0µs 0.01 0.00 3 + PulseAudio Volume Control
! 96 0 0 0.0µs 0.0µs 0.00 0.00 0 PulseAudio Volume Control
filter chain used to trigger the bug:
context.properties = {
log.level = 0
}
context.spa-libs = {
audio.convert.* = audioconvert/libspa-audioconvert
support.* = support/libspa-support
}
context.modules = [
{ name = libpipewire-module-rtkit
args = {
#nice.level = -11
#rt.prio = 88
#rt.time.soft = 2000000
#rt.time.hard = 2000000
}
flags = [ ifexists nofail ]
}
{ name = libpipewire-module-protocol-native }
{ name = libpipewire-module-client-node }
{ name = libpipewire-module-adapter }
{ name = libpipewire-module-filter-chain
args = {
node.name = "sc203_equalizer"
node.description = "SC203 Speaker equalized"
media.name = "SC203 Speaker equalized"
filter.graph = {
nodes = [
# src/modules/module-filter-chain/{builtin_plugin,biquad}.c
{
type = builtin
name = eq_band_1
label = bq_peaking
control = { "Freq" = 58.0 "Q" = 15.0 "Gain" = -15.0 }
}
{
type = builtin
name = eq_band_2
label = bq_peaking
control = { "Freq" = 80.0 "Q" = 20.0 "Gain" = -3.0 }
}
{
type = builtin
name = eq_band_3
label = bq_peaking
control = { "Freq" = 95.0 "Q" = 20.0 "Gain" = -3.0 }
}
{
type = builtin
name = eq_band_4
label = bq_peaking
control = { "Freq" = 117.0 "Q" = 20.0 "Gain" = -18.0 }
}
{
type = builtin
name = eq_band_5
label = bq_peaking
control = { "Freq" = 137.0 "Q" = 20.0 "Gain" = -6.0 }
}
{
type = builtin
name = eq_band_6
label = bq_peaking
control = { "Freq" = 149.0 "Q" = 20.0 "Gain" = -3.0 }
}
{
type = builtin
name = eq_band_7
label = bq_peaking
control = { "Freq" = 165.0 "Q" = 20.0 "Gain" = -3.0 }
}
]
links = [
{ output = "eq_band_1:Out" input = "eq_band_2:In" }
{ output = "eq_band_2:Out" input = "eq_band_3:In" }
{ output = "eq_band_3:Out" input = "eq_band_4:In" }
{ output = "eq_band_4:Out" input = "eq_band_5:In" }
{ output = "eq_band_5:Out" input = "eq_band_6:In" }
{ output = "eq_band_6:Out" input = "eq_band_7:In" }
]
}
capture.props = {
media.class = Audio/Sink
audio.channels = 2
}
playback.props = {
node.target = "alsa_card.usb-EVE_SC203_Speaker-00"
node.passive = true
audio.channels = 2
}
}
}
]
Thanks a lot! :)