filter-graph: allow 0 input and output ports

There is no reason to fail when there is no input or output port.
We can simply run the graph with what there is. Even if there is no
input or output at all, running one instance of the plugins is
possible.

Add a busy builtin plugin that has no ports and keeps the CPU IDLE or
busy for the give percent.
This commit is contained in:
Wim Taymans 2026-01-21 13:51:38 +01:00
parent ba3e564e34
commit a97c4d10af
3 changed files with 144 additions and 18 deletions

View file

@ -652,6 +652,36 @@ extern struct spa_handle_factory spa_filter_graph_factory;
* of "Attack (s)" seconds. The noise gate stays open for at least "Hold (s)"
* seconds before it can close again.
*
* ### Busy
*
* The `busy` plugin has no input or output ports and it can be used to keep the
* CPU or graph busy for the given percent of time.
*
* The node requires a `config` section with extra configuration:
*
*\code{.unparsed}
* filter.graph = {
* nodes = [
* {
* type = builtin
* name = ...
* label = busy
* config = {
* wait-percent = 0.0
* cpu-percent = 50.0
* }
* ...
* }
* }
* ...
* }
*\endcode
*
* - `wait-percent` the percentage of time to wait. This keeps the graph busy but
* not the CPU. Default 0.0
* - `cpu-percent` the percentage of time to keep the CPU busy. This keeps both the
* graph and CPU busy. Default 0.0
*
*
* ## SOFA filters
*