From db569ab56617526ab529aa38c1df4074881720cc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 19 Jun 2026 14:26:42 +0200 Subject: [PATCH] buffers: fix the params iteration logic A 0 result from the iteration with a NULL filter means the end of the iteration, if we get this for the first item, we assume there was no item (same as unknown item) A 0 result for the iteration with filter means nothing matches the filter and so the filter should not be included in the result. A result of -ENOENT means the param is unknown and the filter should be included in the result. Fixes #5313 --- src/pipewire/buffers.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pipewire/buffers.c b/src/pipewire/buffers.c index e445b7700..ecdf19165 100644 --- a/src/pipewire/buffers.c +++ b/src/pipewire/buffers.c @@ -159,10 +159,10 @@ param_filter(struct pw_buffers *this, if (in_res < 1) { /* in_res == -ENOENT : unknown parameter, assume NULL and we will * exit the loop below. - * in_res == 0 : no data, assume NULL + * in_res == 0 : no data, assume NULL when first item * in_res < 0 : some error, exit now */ - if (in_res == 0) + if (in_res == 0 && iidx == 0) in_res = -ENOENT; if (in_res == -ENOENT) iparam = NULL; @@ -179,8 +179,6 @@ param_filter(struct pw_buffers *this, id, &oidx, iparam, &oparam, result); /* out_res < 1 : no value or error, exit now */ - if (out_res == 0) - out_res = -ENOENT; if (out_res < 1) break;