Message ID | 20220110165524.72978-3-jacopo@jmondi.org |
---|---|
State | Accepted |
Delegated to: | Jacopo Mondi |
Headers | show |
Series |
|
Related | show |
Hi Jacopo, On Tue, Jan 11, 2022 at 1:54 AM Jacopo Mondi <jacopo@jmondi.org> wrote: > > 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@jmondi.org> I confirm both PlatformFrameBufferAllocators' constructors are cheap. So creating always sounds good to me. > --- > 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 032b0407bd32..eeeb238f395c 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>(); I think mutex_ should be now non pointer, just instance as it is always created. For PFBAllocator, either pointer or instance is fine for me. With the nit, Reviewed-by: Hirokazu Honda<hiroh@chromium.org> > > camera3Stream_->max_buffers = configuration().bufferCount; > > -- > 2.34.1 >
diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 032b0407bd32..eeeb238f395c 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;
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@jmondi.org> --- src/android/camera_stream.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)