don't check contents of control values

The control values do not have to contain valid values when they
are set so don't try to parse them. Instead just do a simple sanity
check on the size.
Handle the case where we clear the io area, go back to the default
node properties.
This commit is contained in:
Wim Taymans 2017-12-01 10:13:53 +01:00
parent d2516398ed
commit 3a9070ee10
2 changed files with 14 additions and 8 deletions

View file

@ -753,9 +753,15 @@ impl_node_port_set_io(struct spa_node *node,
else if (id == t->io.ControlRange)
port->io_range = data;
else if (id == t->io_prop_volume && direction == SPA_DIRECTION_INPUT)
port->io_volume = &SPA_POD_VALUE(struct spa_pod_double, data);
if (data && size >= sizeof(struct spa_pod_double))
port->io_volume = &SPA_POD_VALUE(struct spa_pod_double, data);
else
port->io_volume = &port->props.volume;
else if (id == t->io_prop_mute && direction == SPA_DIRECTION_INPUT)
port->io_mute = &SPA_POD_VALUE(struct spa_pod_bool, data);
if (data && size >= sizeof(struct spa_pod_bool))
port->io_mute = &SPA_POD_VALUE(struct spa_pod_bool, data);
else
port->io_mute = &port->props.mute;
else
return -ENOENT;

View file

@ -905,21 +905,21 @@ impl_node_port_set_io(struct spa_node *node,
else if (id == t->io.ControlRange)
this->io_range = data;
else if (id == t->io_prop_wave) {
if (SPA_POD_TYPE(data) == SPA_POD_TYPE_ID)
if (data && size >= sizeof(struct spa_pod_id))
this->io_wave = &SPA_POD_VALUE(struct spa_pod_id, data);
else
return -EINVAL;
this->io_wave = &this->props.wave;
}
else if (id == t->io_prop_freq)
if (SPA_POD_TYPE(data) == SPA_POD_TYPE_DOUBLE)
if (data && size >= sizeof(struct spa_pod_double))
this->io_freq = &SPA_POD_VALUE(struct spa_pod_double, data);
else
return -EINVAL;
this->io_freq = &this->props.freq;
else if (id == t->io_prop_volume)
if (SPA_POD_TYPE(data) == SPA_POD_TYPE_DOUBLE)
if (data && size >= sizeof(struct spa_pod_double))
this->io_volume = &SPA_POD_VALUE(struct spa_pod_double, data);
else
return -EINVAL;
this->io_volume = &this->props.volume;
else
return -ENOENT;