From 43257e86764eec3ae2f0c6bb3825f2e7a46f69b7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 31 Jan 2020 13:36:44 +0100 Subject: [PATCH] graph: make pending/required fields signed So that we can check for negative value. Also don't signal incomplete graph when we signaled more than expected, this can happen when we add new nodes in the current cycle and then triggered the driver. --- spa/include/spa/graph/graph.h | 4 ++-- src/pipewire/impl-node.c | 4 ++-- src/pipewire/private.h | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spa/include/spa/graph/graph.h b/spa/include/spa/graph/graph.h index a90754130..cf3f528cf 100644 --- a/spa/include/spa/graph/graph.h +++ b/spa/include/spa/graph/graph.h @@ -46,8 +46,8 @@ struct spa_graph_port; struct spa_graph_state { int status; /**< current status */ - uint32_t required; /**< required number of signals */ - uint32_t pending; /**< number of pending signals */ + int32_t required; /**< required number of signals */ + int32_t pending; /**< number of pending signals */ }; static inline void spa_graph_state_reset(struct spa_graph_state *state) diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 415d7e0f9..3d55a6748 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -1312,8 +1312,8 @@ static int node_ready(void *data, int status) uint32_t owner[2], reposition_owner; uint64_t min_timeout = UINT64_MAX; - if (a->state[0].pending != 0) { - pw_log_warn(NAME" %p: graph not finished", node); + if (a->state[0].pending > 0) { + pw_log_warn(NAME" %p: graph not finished: pending %d", node, a->state[0].pending); pw_context_driver_emit_incomplete(node->context, node); dump_states(node); node->rt.target.signal(node->rt.target.data); diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 611978058..e705c8a23 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -356,23 +356,23 @@ struct pw_impl_device { #define pw_impl_module_emit_registered(m) pw_impl_module_emit(m, registered, 0) struct pw_impl_module { - struct pw_context *context; /**< the context object */ - struct spa_list link; /**< link in the context module_list */ - struct pw_global *global; /**< global object for this module */ + struct pw_context *context; /**< the context object */ + struct spa_list link; /**< link in the context module_list */ + struct pw_global *global; /**< global object for this module */ struct spa_hook global_listener; struct pw_properties *properties; /**< properties of the module */ - struct pw_module_info info; /**< introspectable module info */ + struct pw_module_info info; /**< introspectable module info */ struct spa_hook_list listener_list; - void *user_data; /**< module user_data */ + void *user_data; /**< module user_data */ }; struct pw_node_activation_state { - int status; /**< current status */ - uint32_t required; /**< required number of signals */ - uint32_t pending; /**< number of pending signals */ + int status; /**< current status */ + int32_t required; /**< required number of signals */ + int32_t pending; /**< number of pending signals */ }; static inline void pw_node_activation_state_reset(struct pw_node_activation_state *state)