stream: improve async handling

We can remove most of the special async handling in adapter, filter and
stream because this is now handled in the core.

Add a node.data-loop property to assign the node to a named data-loop.

Assign the non-rt stream and filter to the main loop. This means that
the node fd will be added to the main-loop and will be woken up directly
without having to wake up the RT thread and invoke the process callback
in the main-loop first. Because non-RT implies async, we can do all of
this like we do our rt processing because the output will only be used
in the next cycle.
This commit is contained in:
Wim Taymans 2024-04-18 12:20:38 +02:00
parent 34be6c76a6
commit e1e0a886d5
8 changed files with 57 additions and 99 deletions

View file

@ -1664,11 +1664,7 @@ static int impl_node_process(void *object)
break;
done = (status & (SPA_STATUS_HAVE_DATA | SPA_STATUS_DRAINED));
/* when not async, we can return the data when we are done.
* In async mode we might first need to wake up the follower
* to asynchronously provide more data for the next round. */
if (!this->async && done)
if (done)
break;
if (status & SPA_STATUS_NEED_DATA) {
@ -1684,10 +1680,6 @@ static int impl_node_process(void *object)
if ((fstatus & (SPA_STATUS_HAVE_DATA | SPA_STATUS_DRAINED)) == 0)
break;
}
/* converter produced something or is drained and we
* scheduled the follower above, we can stop now*/
if (done)
break;
}
if (!done)
spa_node_call_xrun(&this->callbacks, 0, 0, NULL);