From e807ed58704c29c3f894c7fb65442afdde4679b3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 8 Jul 2022 18:11:00 +0200 Subject: [PATCH] output/PipeWire: ignore SPA_PROP_channelVolumes if n_values==0 After connecting, PipeWire sometimes sends SPA_PROP_channelVolumes with no values, and this led to "volume=-NaN". --- src/output/plugins/PipeWireOutputPlugin.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx index cfa45292d..a64471a15 100644 --- a/src/output/plugins/PipeWireOutputPlugin.cxx +++ b/src/output/plugins/PipeWireOutputPlugin.cxx @@ -223,6 +223,9 @@ private: } void OnChannelVolumes(const struct pw_stream_control &control) noexcept { + if (control.n_values < 1) + return; + float sum = std::accumulate(control.values, control.values + control.n_values, 0.0f);