Skip to content

pipewire-alsa: Implement pause and make sure to play silence if nothing is written to the device.

Oschowa requested to merge Oschowa/pipewire:pw_alsa_pause_fixes into master

While testing retroarch with it's alsa backend and the pipewire alsa plug-in, I noticed that it plays noise instead of silence when paused, which doesn't happen on a real alsa device or the pulseaudio alsa plug-in.
I found that retroarch has two paths to pause the audio playback:
(1) When the menu is opened while a core is running, it will call snd_pcm_pause() if the device exposes the pause capability, otherwise just stop writing to the device. (2) If the core is paused without opening the menu, it will just stop writing to the device.

92c541ea on it's own is enough to stop playing noise in both cases, whereas 86acbabe only prevents noise in case (1), but since implementing pause is seems trivial I added it to this series.

Before all that are some fixes for inconsistent formatting because it was prevalent in the functions modified.

Tested with the alsa backends of mpv, vlc and retroarch.

Edited by Oschowa

Merge request reports