[libcamera-devel] [PATCH 6/7] libcamera: pipeline: vimc: Queue the buffers
Kaaira Gupta
kgupta at es.iitr.ac.in
Fri Jul 24 17:16:54 CEST 2020
On Wed, Jul 22, 2020 at 07:00:08PM +0530, Kaaira Gupta wrote:
> Queue the buffers correctly according to the streams requested.
>
> Signed-off-by: Kaaira Gupta <kgupta at es.iitr.ac.in>
> ---
> src/libcamera/pipeline/vimc/vimc.cpp | 31 +++++++++++++++++++---------
> 1 file changed, 21 insertions(+), 10 deletions(-)
>
> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
> index 6010e1e..7e8d355 100644
> --- a/src/libcamera/pipeline/vimc/vimc.cpp
> +++ b/src/libcamera/pipeline/vimc/vimc.cpp
> @@ -536,19 +536,30 @@ int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)
> int PipelineHandlerVimc::queueRequestDevice(Camera *camera, Request *request)
> {
> VimcCameraData *data = cameraData(camera);
> - FrameBuffer *buffer = request->findBuffer(&data->rgbStream_);
> - if (!buffer) {
> - LOG(VIMC, Error)
> - << "Attempt to queue request with invalid stream";
> + for (auto it : request->buffers()) {
> + Stream *stream = static_cast<Stream *>(it.first);
> + FrameBuffer *buffer = it.second;
> + if (!buffer) {
> + LOG(VIMC, Error)
> + << "Attempt to queue request with invalid stream";
> +
> + return -ENOENT;
> + }
>
> - return -ENOENT;
> - }
> + int ret;
>
> - int ret = processControls(data, request);
> - if (ret < 0)
> - return ret;
> + if (stream == &data->rgbStream_)
> + ret = data->video_->queueBuffer(buffer);
> + if (stream == &data->rawStream_)
> + ret = data->raw_->queueBuffer(buffer);
> + else
> + continue;
>
> - ret = data->video_->queueBuffer(buffer);
> + if (ret < 0)
> + return ret;
> + return ret;
This return statement prevents control from moving out of the loop.
It should be removed.
> + }
> + int ret = processControls(data, request);
> if (ret < 0)
> return ret;
Since there is a 'return 0' after this, it could simply be
ret = processControls(data, request);
return ret;
by declaring ret outside of the loop ofcourse.
>
> --
> 2.17.1
>
More information about the libcamera-devel
mailing list