pipewire-pulse: Sink input volume update feedback loop (should ignore identical volume updates)
Has anyone noticed issues with volume control in applications that use pulseaudio volume control?
Because pipewire-pulse seems to cause a feedback loop in how it handles the volume updates. I had to fix my code to avoid it:
https://github.com/saivert/ddb_output_pulse2/commit/f2556506b6cba0f98f63666612c7a465a1a154ef
diff --git a/pulse.c b/pulse.c
index 4a3c933..73582f2 100644
--- a/pulse.c
+++ b/pulse.c
@@ -282,6 +282,7 @@ static void _pa_sink_input_info_cb(pa_context *c,
void *data)
{
if (i && plugin.has_volume) {
+ if (pa_cvolume_equal(&pa_vol, &i->volume)) return;
memcpy(&pa_vol, &i->volume, sizeof(pa_vol));
pa_volume_t v = pa_cvolume_avg(&pa_vol);
if (v <= PA_VOLUME_NORM) {
I guess that is good practice regardless but this code never caused issues with actual pulseaudio.
Please check the do_set_stream_volume
function in pulse-server.c
. It doesn't check if the volume actually changed.
It does look like Pulseaudio does: https://github.com/pulseaudio/pulseaudio/blob/c05c6f9eeecb507542be2f0399c73ec2572601e1/src/pulsecore/sink-input.c#L1288