[libcamera-devel] [PATCH v1 2/2] pipeline: raspberrypi: Do not unconditionally free buffers on close
Naushir Patuck
naush at raspberrypi.com
Fri Oct 28 15:49:03 CEST 2022
Hi Kieran,
Thanks for the review.
On Fri, 28 Oct 2022 at 14:46, Kieran Bingham <
kieran.bingham at ideasonboard.com> wrote:
> Quoting Naushir Patuck via libcamera-devel (2022-10-28 12:52:00)
> > When a camera is terminated, do not unconditionally free buffers in the
> > RPiCameraData destructor. Otherwise, this causes harmless error log
> messages
> > to be displayed if no buffer have previously been allocated.
> >
>
> Much like the V4L2 patch, I would think putting this check into
> the beginning of void RPiCameraData::freeBuffers() would be safer.
>
> I see freeBuffers is called a few times, (configure, start), which I
> presume already ensure they are allocated ... but catching this for sure
> for all cases could make sense.
>
Agree, I'll make the update shortly. Again, I blame Friday!!
Naush
>
> Anyway, that's up to you, however you prefer:
>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>
> > Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> > ---
> > src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > index 343f8cb2c7ed..31107e1338bf 100644
> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > @@ -191,7 +191,8 @@ public:
> >
> > ~RPiCameraData()
> > {
> > - freeBuffers();
> > + if (buffersAllocated_)
> > + freeBuffers();
> > }
> >
> > void freeBuffers();
> > --
> > 2.25.1
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20221028/58210cc1/attachment.htm>
More information about the libcamera-devel
mailing list