From 6e0ba50a9cb9ff082563adfd21823368c0ae1655 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 15 Apr 2021 20:39:12 +0200 Subject: [PATCH] libcamera: use the buffer datatype as the port type In use buffers we need to respect the buffer data type. --- spa/plugins/libcamera/libcamera-utils.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spa/plugins/libcamera/libcamera-utils.c b/spa/plugins/libcamera/libcamera-utils.c index 9b57ee4a6..c530f03e0 100644 --- a/spa/plugins/libcamera/libcamera-utils.c +++ b/spa/plugins/libcamera/libcamera-utils.c @@ -675,7 +675,14 @@ static int spa_libcamera_use_buffers(struct impl *this, struct spa_buffer **buff if (n_buffers > 0) { d = buffers[0]->datas; - port->memtype = SPA_DATA_DmaBuf; + if (d[0].type == SPA_DATA_MemPtr && d[0].data != NULL) { + port->memtype = SPA_DATA_MemPtr; + } else if (d[0].type == SPA_DATA_DmaBuf) { + port->memtype = SPA_DATA_DmaBuf; + } else { + spa_log_error(this->log, "v4l2: can't use buffers of type %d", d[0].type); + return -EINVAL; + } } for (i = 0; i < n_buffers; i++) {