[PATCH v2 01/18] libcamera: pipeline: simple: fix size adjustment in validate()
Milan Zamazal
mzamazal at redhat.com
Tue Jan 23 13:58:32 CET 2024
Hans de Goede <hdegoede at redhat.com> writes:
> From: Andrey Konovalov <andrey.konovalov at linaro.org>
>
> SimpleCameraConfiguration::validate() adjusts the configuration
> of its streams (if the size is not in the outputSizes) to
> the captureSize. But the captureSize itself can be not in the
> outputSizes, and then the adjusted configuration won't be
> valid resulting in camera configuration failure.
>
> Signed-off-by: Andrey Konovalov <andrey.konovalov at linaro.org>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> Tested-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org> # sc8280xp Lenovo x13s
> Tested-by: Pavel Machek <pavel at ucw.cz>
Reviewed-by: Milan Zamazal <mzamazal at redhat.com>
> ---
> src/libcamera/pipeline/simple/simple.cpp | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
> index 911051b2..4d0e7255 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -997,10 +997,13 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()
> }
>
> if (!pipeConfig_->outputSizes.contains(cfg.size)) {
> + Size adjustedSize = pipeConfig_->captureSize;
> + if (!pipeConfig_->outputSizes.contains(adjustedSize))
> + adjustedSize = pipeConfig_->outputSizes.max;
> LOG(SimplePipeline, Debug)
> << "Adjusting size from " << cfg.size
> - << " to " << pipeConfig_->captureSize;
> - cfg.size = pipeConfig_->captureSize;
> + << " to " << adjustedSize;
> + cfg.size = adjustedSize;
> status = Adjusted;
> }
More information about the libcamera-devel
mailing list