mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-19 08:57:14 -05:00
improve debug and error handling
This commit is contained in:
parent
6c7d2d0e1e
commit
d27674722a
6 changed files with 25 additions and 19 deletions
|
|
@ -811,7 +811,8 @@ static int impl_node_process(struct spa_node *node)
|
||||||
inio = inport->io;
|
inio = inport->io;
|
||||||
spa_return_val_if_fail(inio != NULL, -EIO);
|
spa_return_val_if_fail(inio != NULL, -EIO);
|
||||||
|
|
||||||
spa_log_trace(this->log, NAME " %p: status %p %d %d", this,
|
spa_log_trace(this->log, NAME " %p: status %p %d %d -> %p %d %d", this,
|
||||||
|
inio, inio->status, inio->buffer_id,
|
||||||
outio, outio->status, outio->buffer_id);
|
outio, outio->status, outio->buffer_id);
|
||||||
|
|
||||||
if (outio->status == SPA_STATUS_HAVE_BUFFER)
|
if (outio->status == SPA_STATUS_HAVE_BUFFER)
|
||||||
|
|
@ -857,7 +858,7 @@ static int impl_node_process(struct spa_node *node)
|
||||||
outb->datas[i].chunk->size = (n_bytes / inport->stride) * outport->stride;
|
outb->datas[i].chunk->size = (n_bytes / inport->stride) * outport->stride;
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_log_trace(this->log, NAME " %p: %d %d %d %d %d %d", this,
|
spa_log_trace(this->log, NAME " %p: n_src:%d n_dst:%d in_offset:%d size:%d maxsize:%d n_bytes:%d", this,
|
||||||
n_src_datas, n_dst_datas, inport->offset, size, maxsize, n_bytes);
|
n_src_datas, n_dst_datas, inport->offset, size, maxsize, n_bytes);
|
||||||
|
|
||||||
this->convert(this, n_dst_datas, dst_datas, n_src_datas, src_datas, n_bytes);
|
this->convert(this, n_dst_datas, dst_datas, n_src_datas, src_datas, n_bytes);
|
||||||
|
|
|
||||||
|
|
@ -545,13 +545,15 @@ static int port_set_format(struct spa_node *node,
|
||||||
if (spa_format_audio_raw_parse(format, &info.info.raw) < 0)
|
if (spa_format_audio_raw_parse(format, &info.info.raw) < 0)
|
||||||
return -EINVAL;
|
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 (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;
|
return -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
if (info.info.raw.format != SPA_AUDIO_FORMAT_F32P)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
this->stride = sizeof(float);
|
this->stride = sizeof(float);
|
||||||
this->have_format = true;
|
this->have_format = true;
|
||||||
this->format = info;
|
this->format = info;
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,8 @@ static int impl_node_set_param(struct spa_node *node, uint32_t id, uint32_t flag
|
||||||
if (impl->started)
|
if (impl->started)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
if (impl->adapter != impl->cnode) {
|
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)
|
if (this->callbacks && this->callbacks->event)
|
||||||
this->callbacks->event(this->callbacks_data,
|
this->callbacks->event(this->callbacks_data,
|
||||||
|
|
|
||||||
|
|
@ -242,8 +242,8 @@ static void *create_object(void *_data,
|
||||||
pw_resource_error(resource, new_id, -EINVAL, "unknown input port");
|
pw_resource_error(resource, new_id, -EINVAL, "unknown input port");
|
||||||
goto done;
|
goto done;
|
||||||
no_mem:
|
no_mem:
|
||||||
pw_log_error("can't create link");
|
pw_log_error("can't create link: %s", error);
|
||||||
pw_resource_error(resource, new_id, -ENOMEM, "no memory");
|
pw_resource_error(resource, new_id, -ENOMEM, error);
|
||||||
goto done;
|
goto done;
|
||||||
no_bind:
|
no_bind:
|
||||||
pw_resource_error(resource, new_id, res, "can't bind link");
|
pw_resource_error(resource, new_id, res, "can't bind link");
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
||||||
this->rt.out_mix.port.port_id,
|
this->rt.out_mix.port.port_id,
|
||||||
SPA_PARAM_Format, SPA_NODE_PARAM_FLAG_NEAREST,
|
SPA_PARAM_Format, SPA_NODE_PARAM_FLAG_NEAREST,
|
||||||
format)) < 0) {
|
format)) < 0) {
|
||||||
asprintf(&error, "error set output format: %d", res);
|
asprintf(&error, "error set output format: %d (%s)", res, spa_strerror(res));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (SPA_RESULT_IS_ASYNC(res))
|
if (SPA_RESULT_IS_ASYNC(res))
|
||||||
|
|
@ -278,7 +278,7 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
||||||
this->rt.in_mix.port.port_id,
|
this->rt.in_mix.port.port_id,
|
||||||
SPA_PARAM_Format, SPA_NODE_PARAM_FLAG_NEAREST,
|
SPA_PARAM_Format, SPA_NODE_PARAM_FLAG_NEAREST,
|
||||||
format)) < 0) {
|
format)) < 0) {
|
||||||
asprintf(&error, "error set input format: %d", res2);
|
asprintf(&error, "error set input format: %d (%s)", res2, spa_strerror(res2));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (SPA_RESULT_IS_ASYNC(res2)) {
|
if (SPA_RESULT_IS_ASYNC(res2)) {
|
||||||
|
|
|
||||||
|
|
@ -63,16 +63,15 @@ static int tee_process(struct spa_node *data)
|
||||||
struct spa_graph_port *p;
|
struct spa_graph_port *p;
|
||||||
struct spa_io_buffers *io = &this->rt.io;
|
struct spa_io_buffers *io = &this->rt.io;
|
||||||
|
|
||||||
if (!spa_list_is_empty(&node->ports[SPA_DIRECTION_OUTPUT])) {
|
pw_log_trace("port %p: tee input %d %d", this, io->status, io->buffer_id);
|
||||||
pw_log_trace("port %p: tee input %d %d", this, io->status, io->buffer_id);
|
spa_list_for_each(p, &node->ports[SPA_DIRECTION_OUTPUT], link) {
|
||||||
spa_list_for_each(p, &node->ports[SPA_DIRECTION_OUTPUT], link) {
|
struct pw_port_mix *mix = SPA_CONTAINER_OF(p, struct pw_port_mix, port);
|
||||||
struct pw_port_mix *mix = SPA_CONTAINER_OF(p, struct pw_port_mix, port);
|
pw_log_trace("port %p: port %d %p->%p %d", this,
|
||||||
pw_log_trace("port %p: port %d %d %p->%p", this,
|
p->port_id, io, mix->io, mix->io->buffer_id);
|
||||||
p->port_id, p->flags, io, mix->io);
|
*mix->io = *io;
|
||||||
*mix->io = *io;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
io->status = SPA_STATUS_NEED_BUFFER;
|
io->status = SPA_STATUS_NEED_BUFFER;
|
||||||
|
|
||||||
return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
|
return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -833,6 +832,8 @@ int pw_port_set_param(struct pw_port *port, uint32_t mix_id, uint32_t id, uint32
|
||||||
pw_log_debug("port %p: %d set param on mix %d:%d.%d %s: %d (%s)", port, port->state,
|
pw_log_debug("port %p: %d set param on mix %d:%d.%d %s: %d (%s)", port, port->state,
|
||||||
port->direction, port->port_id, p->port_id,
|
port->direction, port->port_id, p->port_id,
|
||||||
spa_debug_type_find_name(spa_type_param, id), res, spa_strerror(res));
|
spa_debug_type_find_name(spa_type_param, id), res, spa_strerror(res));
|
||||||
|
if (res < 0)
|
||||||
|
goto done;
|
||||||
|
|
||||||
if (port->state == PW_PORT_STATE_CONFIGURE) {
|
if (port->state == PW_PORT_STATE_CONFIGURE) {
|
||||||
spa_node_port_set_param(port->mix,
|
spa_node_port_set_param(port->mix,
|
||||||
|
|
@ -847,6 +848,7 @@ int pw_port_set_param(struct pw_port *port, uint32_t mix_id, uint32_t id, uint32
|
||||||
spa_debug_type_find_name(spa_type_param, id), res, spa_strerror(res));
|
spa_debug_type_find_name(spa_type_param, id), res, spa_strerror(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
if (id == SPA_PARAM_Format) {
|
if (id == SPA_PARAM_Format) {
|
||||||
if (param == NULL || res < 0) {
|
if (param == NULL || res < 0) {
|
||||||
free_allocation(&port->allocation);
|
free_allocation(&port->allocation);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue