diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-04-17 17:06:25 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-04-28 11:29:33 +0200 |
commit | ff24be7022b39533cce219468b6fa3ce84460f94 (patch) | |
tree | 3e2e547dcbf049951864644b3be2a1c695ca512d /src | |
parent | 11fd9f171e88464ad1e9121a2f1271906bf31518 (diff) |
libcamera: camera: Check requests before queueing them
Make sure all requests queued to a camera only contain streams which
have been configured and belong to the camera.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/camera.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 655996f2..9cea3fd0 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -732,6 +732,7 @@ Request *Camera::createRequest() * \return 0 on success or a negative error code otherwise * \retval -ENODEV The camera has been disconnected from the system * \retval -EACCES The camera is not running so requests can't be queued + * \retval -EINVAL The request is invalid */ int Camera::queueRequest(Request *request) { @@ -741,6 +742,14 @@ int Camera::queueRequest(Request *request) if (!stateIs(CameraRunning)) return -EACCES; + for (auto const &it : request->buffers()) { + Stream *stream = it.first; + if (activeStreams_.find(stream) == activeStreams_.end()) { + LOG(Camera, Error) << "Invalid request"; + return -EINVAL; + } + } + int ret = request->prepare(); if (ret) { LOG(Camera, Error) << "Failed to prepare request"; |