From 4366621b78a4a34ec768a5e11285dd3aa4ec8054 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 11 May 2026 17:44:59 +0200 Subject: [PATCH] filter-graph: fix max plugin It was reading src[1] twice for no good reason. Fixed it like the min plugin works. --- spa/plugins/filter-graph/plugin_builtin.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/spa/plugins/filter-graph/plugin_builtin.c b/spa/plugins/filter-graph/plugin_builtin.c index 5204f179a..bb9c18428 100644 --- a/spa/plugins/filter-graph/plugin_builtin.c +++ b/spa/plugins/filter-graph/plugin_builtin.c @@ -2496,15 +2496,11 @@ static void max_run(void * Instance, unsigned long SampleCount) } else if (n_srcs == 1) { spa_memcpy(out, src[0], SampleCount * sizeof(float)); } else { - for (p = 0; p < n_srcs; p++) { - if (p == 0) { - for (n = 0; n < SampleCount; n++) - out[n] = SPA_MAX(src[p][n], src[p + 1][n]); - p++; - } else { - for (n = 0; n < SampleCount; n++) - out[n] = SPA_MAX(out[n], src[p][n]); - } + for (n = 0; n < SampleCount; n++) + out[n] = SPA_MAX(src[0][n], src[1][n]); + for (p = 2; p < n_srcs; p++) { + for (n = 0; n < SampleCount; n++) + out[n] = SPA_MAX(out[n], src[p][n]); } } }