pipewire-pulse: Don't send sink-input volume updates unless it has actually changed

This commit is contained in:
Nicolai Syvertsen 2021-02-10 19:11:01 +01:00
parent 2104004382
commit 3c0821775f

View file

@ -2872,6 +2872,10 @@ static int do_set_stream_volume(struct client *client, uint32_t command, uint32_
stream = find_stream(client, id); stream = find_stream(client, id);
if (stream != NULL) { if (stream != NULL) {
if (volume_compare(&stream->volume, &volume) == 0)
goto done;
stream->volume = volume; stream->volume = volume;
stream->volume_set = true; stream->volume_set = true;
@ -2896,6 +2900,7 @@ static int do_set_stream_volume(struct client *client, uint32_t command, uint32_
if ((res = set_node_volume_mute(o, &volume, NULL)) < 0) if ((res = set_node_volume_mute(o, &volume, NULL)) < 0)
return res; return res;
} }
done:
return reply_simple_ack(client, tag); return reply_simple_ack(client, tag);
} }
@ -2921,6 +2926,8 @@ static int do_set_stream_mute(struct client *client, uint32_t command, uint32_t
if (stream != NULL) { if (stream != NULL) {
float val; float val;
if (stream->muted == mute) goto done;
stream->muted = mute; stream->muted = mute;
stream->muted_set = true; stream->muted_set = true;
@ -2947,6 +2954,7 @@ static int do_set_stream_mute(struct client *client, uint32_t command, uint32_t
if ((res = set_node_volume_mute(o, NULL, &mute)) < 0) if ((res = set_node_volume_mute(o, NULL, &mute)) < 0)
return res; return res;
} }
done:
return reply_simple_ack(client, tag); return reply_simple_ack(client, tag);
} }