Passive links are suspended too aggressively
Version, Distribution, Desktop Environment:
- pipewire 0.2.24
- openSuSE Tumbleweed 20210325-0
Description of Problem:
When using PIPEWIRE_LINK_PASSIVE=1
and certain filters (tested with calfjackhost
+jconvolver
in particular), the filter will be suspended as soon as the all input links are removed, even if the filter output has not been fully drained. This results in fragments of the previously playing audio being heard the next time the filter is unsuspended.
How Reproducible:
Easily and consistently reproducible for me, not sure how easy it is to reproduce in general.
Steps to Reproduce:
- Run some filter graph with
PIPEWIRE_LINK_PASSIVE=1
. I'm using several JACK filters (calfjackhost and jconvolver), not sure what the specific requirements are. - Play some audio. I test using
mpv --ao=alsa
. Then, interrupt the program (q
in mpv) in the middle of playback, so the filter gets suspended (confirmed withpw-top
). - Wait a bit, then play some other audio using any other application, thus unsuspending the filter.
Actual Results:
The trailing fragment of the first audio file can still be heard when playback is resumed.
Expected Results:
A passive filter should continue being 'drained' even after all links are removed. I'm not sure what would be the best way to do this API-wise, but I assume you can simply continue feeding it silence for a few frames until the output of the filter is also silence. (How reliable is this? What about filters that e.g. continuously add noise?) Failing that, maybe just continue draining it for a configurable number of periods before actually suspending it.