[libcamera-devel] [PATCH v2 2/5] android: camera_stream: Create allocator unconditionally

Paul Elder paul.elder at ideasonboard.com
Fri May 27 11:34:37 CEST 2022


From: Jacopo Mondi <jacopo at jmondi.org>

With the introduction of PlatformBufferAllocator all CameraStream can
be used to allocate buffers on-demand.

Create CameraStream::allocator_ and the associated mutex for all types
of stream.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

---
No change in v2

If we want to make CameraStream::mutex_ into non-pointer (as Hiro
suggested), it should be done on top. Do we want to do that? (I suppose
it doesn't affect this patch itself)
---
 src/android/camera_stream.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp
index 154e088e..045e6006 100644
--- a/src/android/camera_stream.cpp
+++ b/src/android/camera_stream.cpp
@@ -128,10 +128,8 @@ int CameraStream::configure()
 		worker_->start();
 	}
 
-	if (type_ == Type::Internal) {
-		allocator_ = std::make_unique<PlatformFrameBufferAllocator>(cameraDevice_);
-		mutex_ = std::make_unique<Mutex>();
-	}
+	allocator_ = std::make_unique<PlatformFrameBufferAllocator>(cameraDevice_);
+	mutex_ = std::make_unique<Mutex>();
 
 	camera3Stream_->max_buffers = configuration().bufferCount;
 
-- 
2.30.2



More information about the libcamera-devel mailing list