mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
alsa: clean up some latency param handling
This commit is contained in:
parent
6d0613bc9a
commit
7554bdea97
2 changed files with 7 additions and 6 deletions
|
|
@ -687,12 +687,13 @@ impl_node_port_set_param(void *object,
|
||||||
break;
|
break;
|
||||||
case SPA_PARAM_Latency:
|
case SPA_PARAM_Latency:
|
||||||
{
|
{
|
||||||
|
enum spa_direction other = SPA_DIRECTION_REVERSE(direction);
|
||||||
struct spa_latency_info info;
|
struct spa_latency_info info;
|
||||||
if (param == NULL)
|
if (param == NULL)
|
||||||
info = SPA_LATENCY_INFO(SPA_DIRECTION_REVERSE(direction));
|
info = SPA_LATENCY_INFO(other);
|
||||||
else if ((res = spa_latency_parse(param, &info)) < 0)
|
else if ((res = spa_latency_parse(param, &info)) < 0)
|
||||||
return res;
|
return res;
|
||||||
if (direction == info.direction)
|
if (info.direction != other)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
this->latency[info.direction] = info;
|
this->latency[info.direction] = info;
|
||||||
|
|
|
||||||
|
|
@ -609,7 +609,7 @@ impl_node_port_set_param(void *object,
|
||||||
const struct spa_pod *param)
|
const struct spa_pod *param)
|
||||||
{
|
{
|
||||||
struct state *this = object;
|
struct state *this = object;
|
||||||
int res;
|
int res = 0;
|
||||||
|
|
||||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||||
|
|
||||||
|
|
@ -621,19 +621,19 @@ impl_node_port_set_param(void *object,
|
||||||
break;
|
break;
|
||||||
case SPA_PARAM_Latency:
|
case SPA_PARAM_Latency:
|
||||||
{
|
{
|
||||||
|
enum spa_direction other = SPA_DIRECTION_REVERSE(direction);
|
||||||
struct spa_latency_info info;
|
struct spa_latency_info info;
|
||||||
if (param == NULL)
|
if (param == NULL)
|
||||||
info = SPA_LATENCY_INFO(SPA_DIRECTION_REVERSE(direction));
|
info = SPA_LATENCY_INFO(other);
|
||||||
else if ((res = spa_latency_parse(param, &info)) < 0)
|
else if ((res = spa_latency_parse(param, &info)) < 0)
|
||||||
return res;
|
return res;
|
||||||
if (direction == info.direction)
|
if (info.direction != other)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
this->latency[info.direction] = info;
|
this->latency[info.direction] = info;
|
||||||
this->port_info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
this->port_info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||||
this->port_params[PORT_Latency].user++;
|
this->port_params[PORT_Latency].user++;
|
||||||
emit_port_info(this, false);
|
emit_port_info(this, false);
|
||||||
res = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue