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
This commit is contained in:
Wim Taymans 2026-06-19 14:26:42 +02:00
parent 31e48d56f9
commit db569ab566

View file

@ -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;