From f8e2813ffe0943fabcff26e47bf4891c07ea18ab Mon Sep 17 00:00:00 2001 From: Umang Jain Date: Fri, 21 Aug 2020 14:46:08 +0000 Subject: android: camera_device: Make CameraDevice a shared object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CameraDevice needs to be wrapper into the std::shared_ptr instead of std::unique_ptr to enable refcounting. The refcounting will help us to support hotplug and hot-unplug CameraHalManager operations in the subsequent commit. Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Signed-off-by: Laurent Pinchart --- src/android/camera_hal_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/android/camera_hal_manager.cpp') diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp index 3d6d2b45..3a744af5 100644 --- a/src/android/camera_hal_manager.cpp +++ b/src/android/camera_hal_manager.cpp @@ -64,12 +64,12 @@ int CameraHalManager::init() */ unsigned int index = 0; for (auto &cam : cameraManager_->cameras()) { - CameraDevice *camera = new CameraDevice(index, cam); + std::shared_ptr camera = CameraDevice::create(index, cam); ret = camera->initialize(); if (ret) continue; - cameras_.emplace_back(camera); + cameras_.emplace_back(std::move(camera)); ++index; } -- cgit v1.2.1