[PATCH 2/5] pipeline_handler: Call releaseDevice() before unlocking media devices

Hans de Goede hdegoede at redhat.com
Tue Aug 20 21:50:13 CEST 2024


It is better / more logical to call releaseDevice() before unlocking
the devices. ATM 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 <hdegoede at redhat.com>
---
 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_;
 }
 
-- 
2.46.0



More information about the libcamera-devel mailing list