improve debug and error handling

This commit is contained in:
Wim Taymans 2018-10-17 10:02:44 +02:00
parent 6c7d2d0e1e
commit d27674722a
6 changed files with 25 additions and 19 deletions

View file

@ -545,13 +545,15 @@ static int port_set_format(struct spa_node *node,
if (spa_format_audio_raw_parse(format, &info.info.raw) < 0)
return -EINVAL;
if (info.info.raw.format != SPA_AUDIO_FORMAT_F32P)
return -EINVAL;
if (info.info.raw.channels != 1)
return -EINVAL;
if (this->have_format) {
if (memcmp(&info, &this->format, sizeof(struct spa_audio_info)))
if (info.info.raw.rate != this->format.info.raw.rate)
return -EINVAL;
} else {
if (info.info.raw.format != SPA_AUDIO_FORMAT_F32P)
return -EINVAL;
this->stride = sizeof(float);
this->have_format = true;
this->format = info;

View file

@ -173,7 +173,8 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
if (impl->started)
return -EIO;
if (impl->adapter != impl->cnode) {
spa_node_set_param(impl->adapter, id, flags, param);
if ((res = spa_node_set_param(impl->adapter, id, flags, param)) < 0)
return res;
if (this->callbacks && this->callbacks->event)
this->callbacks->event(this->callbacks_data,

View file

@ -242,8 +242,8 @@ static void *create_object(void *_data,
pw_resource_error(resource, new_id, -EINVAL, "unknown input port");
goto done;
no_mem:
pw_log_error("can't create link");
pw_resource_error(resource, new_id, -ENOMEM, "no memory");
pw_log_error("can't create link: %s", error);
pw_resource_error(resource, new_id, -ENOMEM, error);
goto done;
no_bind:
pw_resource_error(resource, new_id, res, "can't bind link");