mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
audioconvert: improve latency handling
When setting the Latency parameter on one side of the converter, set it also on the other size. We should actually implement propagating the latency through all the elements of the converter later. Implement latency handling on fmtconvert. merger and splitter change latency on all ports when on port changes. All this makes the configured and exposed latencies visible on all ports from adapter.
This commit is contained in:
parent
22fe0b293a
commit
48e6e41d95
4 changed files with 91 additions and 45 deletions
|
|
@ -817,8 +817,8 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
break;
|
||||
case SPA_PARAM_Latency:
|
||||
switch (result.index) {
|
||||
case 0:
|
||||
param = spa_latency_build(&b, id, &this->latency[direction]);
|
||||
case 0: case 1:
|
||||
param = spa_latency_build(&b, id, &this->latency[result.index]);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
|
@ -946,19 +946,16 @@ static int port_set_latency(void *object,
|
|||
return -EINVAL;
|
||||
this->latency[other] = info;
|
||||
}
|
||||
if (direction == SPA_DIRECTION_OUTPUT) {
|
||||
for (i = 0; i < this->port_count; i++) {
|
||||
port = GET_IN_PORT(this, i);
|
||||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->params[IDX_Latency].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
emit_port_info(this, port, false);
|
||||
}
|
||||
} else {
|
||||
port = GET_OUT_PORT(this, 0);
|
||||
for (i = 0; i < this->port_count; i++) {
|
||||
port = GET_IN_PORT(this, i);
|
||||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->params[IDX_Latency].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
emit_port_info(this, port, false);
|
||||
}
|
||||
port = GET_OUT_PORT(this, 0);
|
||||
port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port->params[IDX_Latency].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
emit_port_info(this, port, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1462,6 +1459,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->monitor_channel_volumes = spa_atob(str);
|
||||
}
|
||||
|
||||
this->latency[SPA_DIRECTION_INPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_INPUT);
|
||||
this->latency[SPA_DIRECTION_OUTPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_OUTPUT);
|
||||
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue