Message ID | 20190422180740.21878-1-niklas.soderlund@ragnatech.se |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
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@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); > } >
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; + } + } + return pipe_->queueRequest(this, request); }
Make sure all requests queued to a camera only contains streams which have been configured and belongs to the camera. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> --- src/libcamera/camera.cpp | 9 +++++++++ 1 file changed, 9 insertions(+)