filter, stream: Fix error check for DMA-BUF buffers

When a buffer is of type SPA_DATA_DmaBuf, the 'data' field
will be NULL - we instead have to check if the file descriptor
is valid. The current code, however, always checks if the
data is NULL, which gives a false positive for DMA-BUF buffers,
signaling an error when there is none.

Fix that by also checking if the buffer type is MemPtr together
with the NULL check of the 'data' field.
This commit is contained in:
Georges Basile Stavracas Neto 2020-12-28 14:27:29 -03:00
parent 4b076549f7
commit 56e2d6a3da
2 changed files with 2 additions and 2 deletions

View file

@ -684,7 +684,7 @@ static int impl_port_use_buffers(void *object,
return res;
SPA_FLAG_SET(b->flags, BUFFER_FLAG_MAPPED);
}
else if (d->data == NULL) {
else if (d->type == SPA_DATA_MemPtr && d->data == NULL) {
pw_log_error(NAME" %p: invalid buffer mem", filter);
return -EINVAL;
}

View file

@ -687,7 +687,7 @@ static int impl_port_use_buffers(void *object,
return res;
SPA_FLAG_SET(b->flags, BUFFER_FLAG_MAPPED);
}
else if (d->data == NULL) {
else if (d->type == SPA_DATA_MemPtr && d->data == NULL) {
pw_log_error(NAME" %p: invalid buffer mem", stream);
return -EINVAL;
}