[libcamera-devel] [PATCH 3/5] android: camera_device: Make abortRequest() take a const

Jacopo Mondi jacopo at jmondi.org
Mon Sep 6 18:07:59 CEST 2021


Hi Hiro,

On Mon, Sep 06, 2021 at 11:27:58PM +0900, Hirokazu Honda wrote:
> Hi Jacopo, thank you for the patch.
>
> On Mon, Sep 6, 2021 at 11:01 PM Jacopo Mondi <jacopo at jmondi.org> wrote:
> >
> > The CameraDevice::abortRequest() function should operate on const
> > pointers.
> >
> > Fix that.
> >
> > Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> > ---
> >  src/android/camera_device.cpp | 2 +-
> >  src/android/camera_device.h   | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> > index 30c173a69720..a0ea138d9499 100644
> > --- a/src/android/camera_device.cpp
> > +++ b/src/android/camera_device.cpp
> > @@ -845,7 +845,7 @@ int CameraDevice::processControls(Camera3RequestDescriptor *descriptor)
> >         return 0;
> >  }
> >
> > -void CameraDevice::abortRequest(camera3_capture_request_t *request)
> > +void CameraDevice::abortRequest(const camera3_capture_request_t *request)
> >  {
> >         notifyError(request->frame_number, nullptr, CAMERA3_MSG_ERROR_REQUEST);
>
> Is it possible to make this const reference?

All the HAL entry points receive parameters by pointer from the
framework. If we want to use references we would have to dereference
them in the HAL code when using them as parameter. I don't think we
would gain much to be honest.

Thanks
   j

>
> -Hiro
> >
> > diff --git a/src/android/camera_device.h b/src/android/camera_device.h
> > index a55769272651..54c4cb9ab499 100644
> > --- a/src/android/camera_device.h
> > +++ b/src/android/camera_device.h
> > @@ -96,7 +96,7 @@ private:
> >         libcamera::FrameBuffer *createFrameBuffer(const buffer_handle_t camera3buffer,
> >                                                   libcamera::PixelFormat pixelFormat,
> >                                                   const libcamera::Size &size);
> > -       void abortRequest(camera3_capture_request_t *request);
> > +       void abortRequest(const camera3_capture_request_t *request);
> >         bool isValidRequest(camera3_capture_request_t *request) const;
> >         void notifyShutter(uint32_t frameNumber, uint64_t timestamp);
> >         void notifyError(uint32_t frameNumber, camera3_stream_t *stream,
> > --
> > 2.32.0
> >


More information about the libcamera-devel mailing list