Small fixes

Init ptr in mem
Use a default memory size when no params
Improve debug
Always push after we have a buffer from pull
This commit is contained in:
Wim Taymans 2017-06-06 09:10:42 +02:00
parent 1feec309ec
commit 4433203d5f
4 changed files with 8 additions and 4 deletions

View file

@ -146,6 +146,7 @@ int pw_memblock_alloc(enum pw_memblock_flags flags, size_t size, struct pw_membl
mem->offset = 0;
mem->flags = flags;
mem->size = size;
mem->ptr = NULL;
use_fd = ! !(flags & (PW_MEMBLOCK_FLAG_MAP_TWICE | PW_MEMBLOCK_FLAG_WITH_FD));

View file

@ -516,6 +516,8 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
max_buffers);
minsize = SPA_MAX(minsize, qminsize);
stride = SPA_MAX(stride, qstride);
} else {
minsize = 4096;
}
}
@ -554,8 +556,8 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
1,
data_sizes, data_strides, &impl->buffer_mem);
pw_log_debug("allocating %d input buffers %p", impl->n_buffers,
impl->buffers);
pw_log_debug("allocating %d input buffers %p %zd %zd", impl->n_buffers,
impl->buffers, minsize, stride);
}
if (out_flags & SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS) {

View file

@ -294,7 +294,8 @@ static int do_pull(struct pw_node *this)
if (res == SPA_RESULT_NEED_BUFFER) {
res = do_pull(outport->node);
pw_log_trace("node %p: pull return %d", outport->node, res);
} else if (res == SPA_RESULT_HAVE_BUFFER) {
}
if (res == SPA_RESULT_HAVE_BUFFER) {
*pi = *po;
pw_log_trace("node %p: have output %d %d", this, pi->status,
pi->buffer_id);

View file

@ -481,7 +481,7 @@ impl_node_port_use_buffers(struct spa_node *node,
if (!((d[0].type == this->type.data.MemPtr ||
d[0].type == this->type.data.MemFd ||
d[0].type == this->type.data.DmaBuf) && d[0].data != NULL)) {
spa_log_error(this->log, "volume %p: invalid memory on buffer %p", this,
spa_log_error(this->log, NAME " %p: invalid memory on buffer %p", this,
buffers[i]);
return SPA_RESULT_ERROR;
}