client-node: handle io reset

This commit is contained in:
Wim Taymans 2018-02-07 17:54:43 +01:00
parent 9225ec29f2
commit 053f251be8

View file

@ -524,31 +524,46 @@ spa_proxy_node_port_set_io(struct spa_node *node,
this = SPA_CONTAINER_OF(node, struct proxy, node); this = SPA_CONTAINER_OF(node, struct proxy, node);
t = this->impl->t; t = this->impl->t;
if (this->resource == NULL)
return 0;
if (!CHECK_PORT(this, direction, port_id)) if (!CHECK_PORT(this, direction, port_id))
return -EINVAL; return -EINVAL;
port = GET_PORT(this, direction, port_id); port = GET_PORT(this, direction, port_id);
if (id == t->io.Buffers) if (id == t->io.Buffers)
port->io = data; port->io = data;
else { else {
struct pw_memblock *mem; struct pw_memblock *mem;
uint32_t memid = this->membase++; uint32_t memid, offset, size;
if ((mem = pw_memblock_find(data)) == NULL) if (data) {
return -EINVAL;
pw_client_node_resource_add_mem(this->resource, if ((mem = pw_memblock_find(data)) == NULL)
memid, return -EINVAL;
t->data.MemFd,
mem->fd, mem->flags); memid = this->membase++;
offset = mem->offset;
size = mem->size;
pw_client_node_resource_add_mem(this->resource,
memid,
t->data.MemFd,
mem->fd, mem->flags);
}
else {
memid = SPA_ID_INVALID;
offset = size = 0;
}
pw_client_node_resource_port_set_io(this->resource, pw_client_node_resource_port_set_io(this->resource,
this->seq, this->seq,
direction, port_id, direction, port_id,
id, id,
memid, memid,
mem->offset, mem->size); offset, size);
} }
return 0; return 0;
} }