From a7a6f19815df81bb53fa3848f8b7e17790bbdf05 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Tue, 21 Sep 2021 14:44:15 +0200 Subject: [PATCH] libcamera: don't set camera configuration in LibCamera::start() There is no need to set and validate the configuration when the camera is started, since this was already made when the camera was opened. The configuration only needs to be set again if the port format changes due a SPA_PARAM_Format parameter. --- spa/plugins/libcamera/libcamera-utils.c | 4 ++++ spa/plugins/libcamera/libcamera_wrapper.cpp | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spa/plugins/libcamera/libcamera-utils.c b/spa/plugins/libcamera/libcamera-utils.c index 3998eefe3..bc34d9082 100644 --- a/spa/plugins/libcamera/libcamera-utils.c +++ b/spa/plugins/libcamera/libcamera-utils.c @@ -481,6 +481,10 @@ static int spa_libcamera_set_format(struct impl *this, struct spa_video_info *fo libcamera_set_streamcfg_width(dev->camera, size->width); libcamera_set_streamcfg_height(dev->camera, size->height); + if(!libcamera_set_config(dev->camera)) { + return -EINVAL; + } + /* start the camera now with the configured params */ libcamera_start_capture(dev->camera); diff --git a/spa/plugins/libcamera/libcamera_wrapper.cpp b/spa/plugins/libcamera/libcamera_wrapper.cpp index d836d5fb4..00dda7a91 100644 --- a/spa/plugins/libcamera/libcamera_wrapper.cpp +++ b/spa/plugins/libcamera/libcamera_wrapper.cpp @@ -486,10 +486,6 @@ extern "C" { } int LibCamera::start() { - if(!this->set_config()) { - return -1; - } - this->streamName_.clear(); for (unsigned int index = 0; index < this->config_->size(); ++index) { StreamConfiguration &cfg = this->config_->at(index);