[pulse] channel mute setting not correctly reported (race condition)
Version, Distribution, Desktop Environment:
0.3.23 (also git@d603c1086ac135648d9807e8807c07e437e52fab), ArchLinux, sway
Description of Problem:
When using mpv and toggling the ao-mute
property the on-screen-display and the actual mute state in pipewire will disagree.
mpv will show "muted" but sound is playing and vice-versa.
How Reproducible: Always reproducible.
Steps to Reproduce: (See also reproduction case in the first comment)
- Configure mpv 0.33.0 with
m cycle ao-mute
in input.conf - Start mpv with the pulseaudio audio-output
- Press the button
m
repeatedly.
Actual Results:
- Audio will be muted and the OSD will show unmuted.
- Audio will play and the OSD will show muted.
- Pavucontrol, pactl and pw-cli show the correct mute status.
Expected Results:
OSD and audio output agree.
Analysis:
mpv first sends a mute command to Pipewire and then immediately issues a call to pa_context_get_sink_input_info()
to update its OSD.
It seems that Pipewire sends the result to pa_context_get_sink_input_info()
before processing the mute command.
Putting a small sleep before pa_context_get_sink_input_info()
works around the issue.
The same happens in VLC. (It's even worse there as some of the mute commands are not processed at all). It seems that for v0.3.12 a similar issue has been fixed:
PipeWire 0.3.12
* Fix a race condition in the node state changes that caused
all kinds of sync and other issues (vlc, mpv, ...)
But I couldn't find the exact commit.
Additional Info: pw.dump