link: avoid multiple concurrent negotiations

When multiple links are created at the same time for the same port, we
get into a race where multiple links will try to set a format
asynchronously and eventually break the links. Avoid this by marking the
port as busy for as long as an async format or buffer is pending and
avoid starting new link negotiation when one of the ports is busy.

This problem was observed when ardour6 tries to link all device capture
ports to its single monitor port.
This commit is contained in:
Wim Taymans 2021-09-07 12:20:36 +02:00
parent 2d88ad179a
commit f0bc0d068e
2 changed files with 92 additions and 18 deletions

View file

@ -836,6 +836,7 @@ struct pw_impl_port {
} rt; /**< data only accessed from the data thread */
unsigned int added:1;
unsigned int destroying:1;
int busy_count;
struct spa_latency_info latency[2]; /**< latencies */
unsigned int have_latency_param:1;