libcamera: pipeline_handler: Fix unlocking media devices too early

PipelineHandler::acquire() only locks the media devices when the first
camera is acquired. If a second camera of a pipeline is acquired only
useCount_ is increased and nothing else is done.

When releasing cameras PipelineHandler::release() should only unlock
the media devices when the last camera is released. But the old code
unlocked on every release().

Fix PipelineHandler::release() to only release the media devices when
the last camera is released.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Harvey Yang <chenghaoyang@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Hans de Goede 2024-08-18 17:43:24 +02:00 committed by Laurent Pinchart
parent fc7250f0b3
commit a3fb0b3d0a

View file

@ -205,6 +205,7 @@ void PipelineHandler::release(Camera *camera)
ASSERT(useCount_);
if (useCount_ == 1)
unlockMediaDevices();
releaseDevice(camera);