diff options
Diffstat (limited to 'src/android')
-rw-r--r-- | src/android/camera3_hal.cpp | 2 | ||||
-rw-r--r-- | src/android/camera_hal_manager.cpp | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/android/camera3_hal.cpp b/src/android/camera3_hal.cpp index 67a497b8..d6e04af2 100644 --- a/src/android/camera3_hal.cpp +++ b/src/android/camera3_hal.cpp @@ -32,7 +32,7 @@ static int hal_get_camera_info(int id, struct camera_info *info) return cameraManager.getCameraInfo(id, info); } -static int hal_set_callbacks([[maybe_unused]] const camera_module_callbacks_t *callbacks) +static int hal_set_callbacks(const camera_module_callbacks_t *callbacks) { cameraManager.setCallbacks(callbacks); diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp index a1805ebc..05b47401 100644 --- a/src/android/camera_hal_manager.cpp +++ b/src/android/camera_hal_manager.cpp @@ -29,7 +29,7 @@ LOG_DECLARE_CATEGORY(HAL); */ CameraHalManager::CameraHalManager() - : cameraManager_(nullptr), numInternalCameras_(0), + : cameraManager_(nullptr), callbacks_(nullptr), numInternalCameras_(0), nextExternalCameraId_(firstExternalCameraId_) { } @@ -70,6 +70,11 @@ CameraDevice *CameraHalManager::open(unsigned int id, { MutexLocker locker(mutex_); + if (!callbacks_) { + LOG(HAL, Error) << "Can't open camera before callbacks are set"; + return nullptr; + } + CameraDevice *camera = cameraDeviceFromHalId(id); if (!camera) { LOG(HAL, Error) << "Invalid camera id '" << id << "'"; |