port: implement latency reporting some more

Implement a port recalculate latency method that takes the min
and max latency of all peer ports and sets that as the new port
latency.
When a link is made, let the output and input port recalculate
latencies.
Pass latency param in audioconvert.
This commit is contained in:
Wim Taymans 2021-05-24 10:05:07 +02:00
parent b588cc6b03
commit cd32404e92
6 changed files with 125 additions and 3 deletions

View file

@ -686,6 +686,12 @@ struct pw_impl_node {
void *user_data; /**< extra user data */
};
struct pw_port_latency {
float quantum; /** quantum multiplier */
uint32_t min; /** min of all peers */
uint32_t max; /** max of all peers */
};
struct pw_impl_port_mix {
struct spa_list link;
struct spa_list rt_link;
@ -790,6 +796,8 @@ struct pw_impl_port {
} rt; /**< data only accessed from the data thread */
unsigned int added:1;
struct pw_port_latency latency[2]; /**< latencies */
void *owner_data; /**< extra owner data */
void *user_data; /**< extra user data */
};
@ -1152,6 +1160,8 @@ int pw_impl_port_set_param(struct pw_impl_port *port,
int pw_impl_port_use_buffers(struct pw_impl_port *port, struct pw_impl_port_mix *mix, uint32_t flags,
struct spa_buffer **buffers, uint32_t n_buffers);
int pw_impl_port_recalc_latency(struct pw_impl_port *port);
/** Change the state of the node */
int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state);