From patchwork Tue Feb 26 02:18:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 628 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8D8FC601E2 for ; Tue, 26 Feb 2019 03:19:29 +0100 (CET) X-Halon-ID: efd1ff10-396c-11e9-985a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id efd1ff10-396c-11e9-985a-005056917f90; Tue, 26 Feb 2019 03:19:27 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Feb 2019 03:18:56 +0100 Message-Id: <20190226021857.28255-8-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226021857.28255-1-niklas.soderlund@ragnatech.se> References: <20190226021857.28255-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 7/8] libcamera: camera: ensure streams belong to camera X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2019 02:19:29 -0000 Before calling into the pipeline handler make sure the streams provided by the application actually belongs to the camera. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/libcamera/camera.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 938f21fe80ef8ceb..ba8638009992170f 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -253,6 +253,10 @@ Camera::streamConfiguration(std::set &streams) if (!stateIsAtleast(Free) || !streams.size()) return std::map{}; + for (Stream *stream : streams) + if (streams_.find(stream) == streams_.end()) + return std::map{}; + return pipe_->streamConfiguration(this, streams); } @@ -290,6 +294,10 @@ int Camera::configureStreams(std::map &config) return -EINVAL; } + for (auto const &iter : config) + if (streams_.find(iter.first) == streams_.end()) + return -EINVAL; + ret = pipe_->configureStreams(this, config); if (ret) return ret;