<div dir="ltr"><div dir="ltr">Hi Hans,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Aug 18, 2024 at 5:43 PM Hans de Goede <<a href="mailto:hdegoede@redhat.com">hdegoede@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">PipelineHandler::acquire() only locks the media devices when the first<br>
camera is acquired. If a second camera of a pipeline is acquired only<br>
useCount_ is increased and nothing else is done.<br>
<br>
When releasing cameras PipelineHandler::release() should only unlock<br>
the media devices when the last camera is released. But the old code<br>
unlocked on every release().<br>
<br>
Fix PipelineHandler::release() to only release the media devices when<br>
the last camera is released.<br>
<br></blockquote><div><br></div><div>Yes, it makes sense to me that we should avoid other processes accessing</div><div>the media devices until the current process releases all acquires/usages.</div><div><br></div><div>Thanks for the fix!</div><div><br></div><div>Reviewed-by: Harvey Yang <<a href="mailto:chenghaoyang@chromium.org">chenghaoyang@chromium.org</a>></div><div> </div><div>BR,</div><div>Harvey</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Signed-off-by: Hans de Goede <<a href="mailto:hdegoede@redhat.com" target="_blank">hdegoede@redhat.com</a>><br>
---<br>
src/libcamera/pipeline_handler.cpp | 3 ++-<br>
1 file changed, 2 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp<br>
index 5a6de685..a20cd27d 100644<br>
--- a/src/libcamera/pipeline_handler.cpp<br>
+++ b/src/libcamera/pipeline_handler.cpp<br>
@@ -205,7 +205,8 @@ void PipelineHandler::release(Camera *camera)<br>
<br>
ASSERT(useCount_);<br>
<br>
- unlockMediaDevices();<br>
+ if (useCount_ == 1)<br>
+ unlockMediaDevices();<br>
<br>
releaseDevice(camera);<br>
<br>
-- <br>
2.46.0<br>
<br>
</blockquote></div></div>