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

@ -712,7 +712,8 @@ do_activate_link(struct spa_loop *loop,
bool async, uint32_t seq, const void *data, size_t size, void *user_data)
{
struct pw_link *this = user_data;
spa_graph_port_link(&this->rt.out_port, &this->rt.in_port);
SPA_FLAG_UNSET(this->rt.out_port.flags, SPA_GRAPH_PORT_FLAG_DISABLED);
SPA_FLAG_UNSET(this->rt.in_port.flags, SPA_GRAPH_PORT_FLAG_DISABLED);
return 0;
}
@ -953,7 +954,8 @@ do_deactivate_link(struct spa_loop *loop,
bool async, uint32_t seq, const void *data, size_t size, void *user_data)
{
struct pw_link *this = user_data;
spa_graph_port_unlink(&this->rt.out_port);
SPA_FLAG_SET(this->rt.out_port.flags, SPA_GRAPH_PORT_FLAG_DISABLED);
SPA_FLAG_SET(this->rt.in_port.flags, SPA_GRAPH_PORT_FLAG_DISABLED);
return 0;
}
@ -1165,13 +1167,14 @@ struct pw_link *pw_link_new(struct pw_core *core,
spa_graph_port_init(&this->rt.out_port,
PW_DIRECTION_OUTPUT,
this->rt.out_port.port_id,
0,
SPA_GRAPH_PORT_FLAG_DISABLED,
&this->io);
spa_graph_port_init(&this->rt.in_port,
PW_DIRECTION_INPUT,
this->rt.in_port.port_id,
0,
SPA_GRAPH_PORT_FLAG_DISABLED,
&this->io);
spa_graph_port_link(&this->rt.out_port, &this->rt.in_port);
this->rt.in_port.scheduler_data = this;
this->rt.out_port.scheduler_data = this;