summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-02-26 02:56:33 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-03-05 22:32:41 +0100
commita3b8083f54beebd44e16facd61d1355cab5e6480 (patch)
tree004ada031490438cec737a992813ef1b4a0da741
parent7401f5002e54dbb2f0c405d00082c4461150aea8 (diff)
libcamera: camera: ensure streams belong to camera
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 <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/camera.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index b4197f95..e3144c5b 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -366,6 +366,11 @@ Camera::streamConfiguration(std::set<Stream *> &streams)
if (disconnected_ || !streams.size())
return std::map<Stream *, StreamConfiguration>{};
+ for (Stream *stream : streams) {
+ if (streams_.find(stream) == streams_.end())
+ return std::map<Stream *, StreamConfiguration>{};
+ }
+
return pipe_->streamConfiguration(this, streams);
}
@@ -409,6 +414,11 @@ int Camera::configureStreams(std::map<Stream *, StreamConfiguration> &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;