[libcamera-devel] [PATCH] libcamera: camera: Check requests before queueing them
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Apr 22 23:15:01 CEST 2019
Hi Niklas,
Thank you for the patch.
On Mon, Apr 22, 2019 at 08:07:40PM +0200, Niklas Söderlund wrote:
> Make sure all requests queued to a camera only contains streams which
s/contains/contain/
> have been configured and belongs to the camera.
s/belongs/belong/
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> src/libcamera/camera.cpp | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
> index 655996f26224ef49..36c7584e823eb580 100644
> --- a/src/libcamera/camera.cpp
> +++ b/src/libcamera/camera.cpp
> @@ -747,6 +747,15 @@ int Camera::queueRequest(Request *request)
> return ret;
> }
>
> + for (auto const &it : request->buffers()) {
> + Stream *stream = it.first;
> + if (activeStreams_.find(stream) == activeStreams_.end()) {
> + LOG(Camera, Error)
> + << "Attempt to queue request with invalid stream";
> + return -EINVAL;
You should document the -EINVAL error code in the return values of
Camera::queueRequest().
> + }
> + }
> +
Should this be done before calling Request::prepare() ? There's no point
in preparing the request if the streams are not valid.
> return pipe_->queueRequest(this, request);
> }
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list