From d14a3f8ae62d74a21f1a04d1fbbbd23b762a6236 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 15 Nov 2020 23:10:50 +0200 Subject: libcamera: pipeline: simple: Reset format on capture side of converter When configuring the converter, the format is first set on the output side based on the format of the camera pipeline output, and then the format is set on the capture side to match the desired stream configuration. The format parameter passed to V4L2VideoDevice::setFormat() uses the same variable for both calls, which has the unwanted side effect of carrying plane configuration from the output side to the capture side of the converter. In particular, the stride or plane size requested on the capture side can become unnecessarily large when converting to a format with a lower number of bits per pixel (for instance converting YUYV to NV12). Fix this by resetting the format variable before using it to configure the capture side. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/simple/converter.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libcamera/pipeline/simple/converter.cpp') diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 57538ab0..67e6e864 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -164,6 +164,7 @@ int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize, /* Set the pixel format and size on the output. */ videoFormat = m2m_->capture()->toV4L2PixelFormat(cfg->pixelFormat); + format = {}; format.fourcc = videoFormat; format.size = cfg->size; -- cgit v1.2.1