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

Message ID 20221111133025.3102-1-david.plowman@raspberrypi.com
Headers show
Series
  • Notify pipeline handlers when a camera is released
Related show

Message

David Plowman Nov. 11, 2022, 1:30 p.m. UTC
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(-)