From 3186a0eb546d405aca2b3554d951ea7b78490465 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 20 Aug 2024 21:50:13 +0200 Subject: libcamera: pipeline_handler: Call releaseDevice() before unlocking media devices It is better / more logical to call releaseDevice() before unlocking the devices. At the moment the only pipeline handler implementing releaseDevice() is the rpi pipeline handler which releases buffers from its releaseDevice() implementation. Releasing buffers before unlocking the media devices is ok to do and arguably it is better to release the buffers before unlocking. Signed-off-by: Hans de Goede Reviewed-by: Harvey Yang Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/libcamera/pipeline_handler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index a20cd27d..1fc22d6a 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -205,11 +205,11 @@ void PipelineHandler::release(Camera *camera) ASSERT(useCount_); + releaseDevice(camera); + if (useCount_ == 1) unlockMediaDevices(); - releaseDevice(camera); - --useCount_; } -- cgit v1.2.1