[libcamera-devel] [PATCH 0/2] Notify pipeline handlers when a camera is released

David Plowman david.plowman at raspberrypi.com
Fri Nov 11 14:30:23 CET 2022


Hi

These patches are actually a follow-up to an email I circulated on 7th
November, entitled "Problems opening/closing camera in different
processes".

It address the problem that when a camera is released, our pipeline
handler never gets to find out. So we have no way to know that this
would be a good moment to free all the buffers we allocated for it.

Rather than continue the discussion, I thought I'd submit some code!

There are 2 small patches here.

The first adds a "releaseDevice" method to the PipelineHandler, that
it calls from its "release" method (trying to follow the "xxx calls
xxxDevice" pattern that I saw).

The second merely implements a "releaseDevice" method for the Pi,
which frees any allocated buffers.

Thanks!
David

David Plowman (2):
  libcamera: Add a PipelineHandler::releaseDevice method
  libcamera: pipeline: raspberrypi: Free buffers when a camera is
    released

 include/libcamera/internal/pipeline_handler.h    |  4 +++-
 src/libcamera/camera.cpp                         |  2 +-
 .../pipeline/raspberrypi/raspberrypi.cpp         |  8 ++++++++
 src/libcamera/pipeline_handler.cpp               | 16 +++++++++++++++-
 4 files changed, 27 insertions(+), 3 deletions(-)

-- 
2.30.2



More information about the libcamera-devel mailing list