mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
node: improve pending results
Make a special function for pending results to make it clear that it is different from normal results. Don't pass result code to result function, it is not useful because since the callback is called, all must be fine. The spa_pending is removed from the list right before the callback and can thus be freed in the callback. Pass the spa_pending in the pending callback so that extra data can be added that way. Reuse spa_pending objects in link and nodes instead of allocating. We always only have one pending operation and we can cancel any pending previous operation by removing the pending.
This commit is contained in:
parent
a3ca2df0fe
commit
98463b689b
33 changed files with 126 additions and 156 deletions
|
|
@ -159,7 +159,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -437,7 +437,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -434,7 +434,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ spa_alsa_enum_format(struct state *state, uint32_t start, uint32_t num,
|
|||
if ((res = spa_pod_filter(&b, &result.param, fmt, filter)) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
goto exit;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -715,7 +715,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -806,7 +806,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -513,7 +513,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -510,7 +510,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -665,7 +665,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -1050,7 +1050,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -491,7 +491,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -508,7 +508,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ struct impl {
|
|||
|
||||
#include "v4l2-utils.c"
|
||||
|
||||
static int impl_node_wait(struct spa_node *node, int res, struct spa_pending *pending,
|
||||
spa_result_func_t func, void *data)
|
||||
static int impl_node_wait(struct spa_node *node, int seq, struct spa_pending *pending,
|
||||
spa_pending_func_t func, void *data)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
@ -247,7 +247,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -574,7 +574,7 @@ static int impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -812,7 +812,7 @@ spa_v4l2_enum_format(struct impl *this,
|
|||
result.param = spa_pod_builder_pop(&b, &f[0]);
|
||||
result.next++;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
goto exit;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -1142,7 +1142,7 @@ spa_v4l2_enum_controls(struct impl *this,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
goto exit;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -591,7 +591,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ static int impl_node_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
@ -434,7 +434,7 @@ impl_node_port_enum_params(struct spa_node *node,
|
|||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||
goto next;
|
||||
|
||||
if ((res = func(data, count, 1, &result)) != 0)
|
||||
if ((res = func(data, count, &result)) != 0)
|
||||
return res;
|
||||
|
||||
if (++count != num)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue