summaryrefslogtreecommitdiff
path: root/spa
diff options
context:
space:
mode:
authorDavid Svensson Fors <davidsf@axis.com>2017-12-01 16:31:37 +0100
committerWim Taymans <wtaymans@redhat.com>2017-12-04 12:15:34 +0100
commit6503351a0de7d00d08cf4a0d21bb31ce15236884 (patch)
treecad2a5bc3c60dcdea8158b3b4c0ab2ef600d104a /spa
parentc1aa3b4625ca47266e2a6771cb80d937b3f365bb (diff)
graph: don't let required number of ports become negative
Add a check against letting the required number of ports become negative for a node. With certain timing between the main and data thread, this can otherwise happen. For nodes where links are unlinked and relinked, a negative number may mean that the scheduler skips the node and doesn't call process_output().
Diffstat (limited to 'spa')
-rw-r--r--spa/include/spa/graph/graph.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/spa/include/spa/graph/graph.h b/spa/include/spa/graph/graph.h
index 30d8531c..4338b119 100644
--- a/spa/include/spa/graph/graph.h
+++ b/spa/include/spa/graph/graph.h
@@ -160,8 +160,10 @@ static inline void spa_graph_port_remove(struct spa_graph_port *port)
{
spa_debug("port %p remove", port);
spa_list_remove(&port->link);
- if (!(port->flags & SPA_PORT_INFO_FLAG_OPTIONAL))
+ if (!(port->flags & SPA_PORT_INFO_FLAG_OPTIONAL) &&
+ port->node->required[port->direction] > 0) {
port->node->required[port->direction]--;
+ }
}
static inline void