From 3a9070ee10a2bab5e5be87993c2f4f7727ab0f5b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 1 Dec 2017 10:13:53 +0100 Subject: 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. --- spa/plugins/audiomixer/audiomixer.c | 10 ++++++++-- spa/plugins/audiotestsrc/audiotestsrc.c | 12 ++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'spa') diff --git a/spa/plugins/audiomixer/audiomixer.c b/spa/plugins/audiomixer/audiomixer.c index 7e5f9ee9..1d128086 100644 --- a/spa/plugins/audiomixer/audiomixer.c +++ b/spa/plugins/audiomixer/audiomixer.c @@ -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; diff --git a/spa/plugins/audiotestsrc/audiotestsrc.c b/spa/plugins/audiotestsrc/audiotestsrc.c index 3b3b4ccd..1016d854 100644 --- a/spa/plugins/audiotestsrc/audiotestsrc.c +++ b/spa/plugins/audiotestsrc/audiotestsrc.c @@ -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; -- cgit v1.2.3