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:
Wim Taymans 2019-02-21 12:14:25 +01:00
parent a3ca2df0fe
commit 98463b689b
33 changed files with 126 additions and 156 deletions

View file

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