graph: new scheduling model

Make explicit links between elements that are used to activate the
next element in the graph.
Make subgraphs a special regular node. Make a link from the
subgraph children to the parent so that the subgraph completes when
all the children completed.
Implement a single process function in plugins
Remove many messages in the client node
This commit is contained in:
Wim Taymans 2018-03-20 11:37:11 +01:00
parent 9b0a880afb
commit 33a322b96e
36 changed files with 401 additions and 750 deletions

View file

@ -47,7 +47,7 @@ static SPA_LOG_IMPL(default_log);
#define spa_debug(f,...) spa_log_trace(&default_log.log, f, __VA_ARGS__)
#include <spa/graph/graph.h>
#include <spa/graph/graph-scheduler1.h>
#include <spa/graph/graph-scheduler2.h>
#include <lib/debug.h>
@ -114,6 +114,7 @@ struct data {
uint32_t n_support;
struct spa_graph graph;
struct spa_graph_state graph_state;
struct spa_graph_data graph_data;
struct spa_graph_node source_node;
struct spa_graph_state source_state;
@ -255,13 +256,13 @@ static void update_props(struct data *data)
data->volume_accum -= M_PI_M2;
}
static void on_sink_need_input(void *_data)
static void on_sink_process(void *_data, int status)
{
struct data *data = _data;
update_props(data);
spa_graph_need_input(&data->graph, &data->sink_node);
spa_graph_node_process(&data->sink_node);
}
static void
@ -276,7 +277,7 @@ static const struct spa_node_callbacks sink_callbacks = {
SPA_VERSION_NODE_CALLBACKS,
.done = on_sink_done,
.event = on_sink_event,
.need_input = on_sink_need_input,
.process = on_sink_process,
.reuse_buffer = on_sink_reuse_buffer
};
@ -564,7 +565,7 @@ int main(int argc, char *argv[])
int res;
const char *str;
spa_graph_init(&data.graph);
spa_graph_init(&data.graph, &data.graph_state);
spa_graph_data_init(&data.graph_data, &data.graph);
spa_graph_set_callbacks(&data.graph, &spa_graph_impl_default, &data.graph_data);