From patchwork Thu Feb 28 02:16:26 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: 651 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 80A13610B7 for ; Thu, 28 Feb 2019 03:16:39 +0100 (CET) X-Halon-ID: e0a78cc7-3afe-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 e0a78cc7-3afe-11e9-985a-005056917f90; Thu, 28 Feb 2019 03:16:37 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Thu, 28 Feb 2019 03:16:26 +0100 Message-Id: <20190228021626.15062-5-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228021626.15062-1-niklas.soderlund@ragnatech.se> References: <20190228021626.15062-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/4] 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: Thu, 28 Feb 2019 02:16:39 -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: Laurent Pinchart --- src/libcamera/camera.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 4f0833300b9b7ffc..52992e577b6ab011 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -337,6 +337,11 @@ Camera::streamConfiguration(std::set &streams) if (disconnected_ || !streams.size()) return std::map{}; + for (Stream *stream : streams) { + if (streams_.find(stream) == streams_.end()) + return std::map{}; + } + return pipe_->streamConfiguration(this, streams); } @@ -378,6 +383,11 @@ 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;