link: use DISABLED flag on port of inactive links

Don't unlink the ports of an inactive link because then it might be
possible that the scheduler can't recycle a buffer, instead use
a port flag to mark the ports disabled and change to scheduler to
skip those ports.
This commit is contained in:
Wim Taymans 2018-01-18 15:39:03 +01:00
parent a8fa4383a1
commit 0eb44b340a
6 changed files with 16 additions and 9 deletions

View file

@ -49,7 +49,7 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
struct spa_graph_node *pnode;
uint32_t prequired, pready;
if ((pport = p->peer) == NULL) {
if ((pport = p->peer) == NULL || (pport->flags & SPA_GRAPH_PORT_FLAG_DISABLED)) {
spa_debug("node %p port %p has no peer", node, p);
continue;
}
@ -94,7 +94,7 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
struct spa_graph_node *pnode;
uint32_t prequired, pready;
if ((pport = p->peer) == NULL) {
if ((pport = p->peer) == NULL || (pport->flags & SPA_GRAPH_PORT_FLAG_DISABLED)) {
spa_debug("node %p port %p has no peer", node, p);
continue;
}

View file

@ -60,7 +60,7 @@ struct spa_graph_node {
struct spa_graph *graph; /**< owner graph */
struct spa_list ports[2]; /**< list of input and output ports */
struct spa_list ready_link; /**< link for scheduler */
#define SPA_GRAPH_NODE_FLAG_ASYNC (1 << 0)
#define SPA_GRAPH_NODE_FLAG_ASYNC (1 << 0)
uint32_t flags; /**< node flags */
uint32_t required[2]; /**< required number of ports */
uint32_t ready[2]; /**< number of ports with data */
@ -74,6 +74,7 @@ struct spa_graph_port {
struct spa_graph_node *node; /**< owner node */
enum spa_direction direction; /**< port direction */
uint32_t port_id; /**< port id */
#define SPA_GRAPH_PORT_FLAG_DISABLED (1 << 0)
uint32_t flags; /**< port flags */
struct spa_io_buffers *io; /**< io area of the port */
struct spa_graph_port *peer; /**< peer */

View file

@ -42,6 +42,10 @@ extern "C" {
#define SPA_RESULT_ASYNC_SEQ(res) ((res) & SPA_ASYNC_SEQ_MASK)
#define SPA_RESULT_RETURN_ASYNC(seq) (SPA_ASYNC_BIT | ((seq) & SPA_ASYNC_SEQ_MASK))
#define SPA_FLAG_CHECK(field,flag) (((field) & (flag)) == (flag))
#define SPA_FLAG_SET(field,flag) ((field) |= (flag))
#define SPA_FLAG_UNSET(field,flag) ((field) &= ~(flag))
enum spa_direction {
SPA_DIRECTION_INPUT = 0,
SPA_DIRECTION_OUTPUT = 1,