mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
alsa: keep track of input and output latency
track and report both input and output latency.
This commit is contained in:
parent
ed9560fb03
commit
8cf5927e95
5 changed files with 49 additions and 13 deletions
|
|
@ -457,7 +457,10 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
case SPA_PARAM_Latency:
|
||||
switch (result.index) {
|
||||
case 0:
|
||||
param = spa_latency_build(&b, id, &this->latency);
|
||||
param = spa_latency_build(&b, id, &this->latency[SPA_DIRECTION_INPUT]);
|
||||
break;
|
||||
case 1:
|
||||
param = spa_latency_build(&b, id, &this->latency[SPA_DIRECTION_OUTPUT]);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
|
@ -561,8 +564,19 @@ impl_node_port_set_param(void *object,
|
|||
res = port_set_format(this, direction, port_id, flags, param);
|
||||
break;
|
||||
case SPA_PARAM_Latency:
|
||||
res = 0;
|
||||
{
|
||||
struct spa_latency_info info;
|
||||
if ((res = spa_latency_parse(param, &info)) < 0)
|
||||
return res;
|
||||
if (direction == info.direction)
|
||||
return -EINVAL;
|
||||
|
||||
this->latency[info.direction] = info;
|
||||
this->port_info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
this->port_params[IDX_Latency].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
emit_port_info(this, false);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = -ENOENT;
|
||||
break;
|
||||
|
|
@ -792,9 +806,12 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
this->stream = SND_PCM_STREAM_CAPTURE;
|
||||
this->latency = SPA_LATENCY_INFO(SPA_DIRECTION_OUTPUT);
|
||||
this->latency.min_quantum = 1.0f;
|
||||
this->latency.max_quantum = 1.0f;
|
||||
this->port_direction = SPA_DIRECTION_OUTPUT;
|
||||
this->latency[this->port_direction] = SPA_LATENCY_INFO(
|
||||
this->port_direction,
|
||||
.min_quantum = 1.0f,
|
||||
.max_quantum = 1.0f);
|
||||
this->latency[SPA_DIRECTION_INPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_INPUT);
|
||||
|
||||
this->info_all = SPA_NODE_CHANGE_MASK_FLAGS |
|
||||
SPA_NODE_CHANGE_MASK_PROPS |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue