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

@ -50,7 +50,7 @@ static SPA_LOG_IMPL(default_log);
#define spa_debug(...) spa_log_trace(&default_log.log,__VA_ARGS__)
#include <spa/graph/graph.h>
#include <spa/graph/graph-scheduler1.h>
#include <spa/graph/graph-scheduler2.h>
struct type {
uint32_t node;
@ -115,6 +115,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 source1_node;
struct spa_graph_state source1_state;
@ -269,12 +270,12 @@ static void update_props(struct data *data)
data->ctrl_volume[1].value = 1.0 - data->ctrl_volume[0].value;
}
static void on_sink_need_input(void *_data)
static void on_sink_process(void *_data, int status)
{
struct data *data = _data;
#ifdef USE_GRAPH
spa_graph_need_input(&data->graph, &data->sink_node);
spa_graph_node_process(&data->sink_node);
#else
int res;
@ -322,7 +323,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
};
@ -717,7 +718,7 @@ int main(int argc, char *argv[])
data.data_loop.remove_source = do_remove_source;
data.data_loop.invoke = do_invoke;
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);