From fb74bb7df66b96dbe28702155cddfc96a1b30f78 Mon Sep 17 00:00:00 2001 From: Anle Pan Date: Thu, 4 Apr 2024 12:18:14 +0200 Subject: android: camera_device: Always clear descriptors_ in stop() When flush() is called and then a new stream configuration is set, the descriptors_ queue might have a chance to be not cleared in stop(), as the Camera is already in Stopped state. This will prevent further requests from being completed in sendCaptureResults() as the descriptors_ queue is not empty. To fix the issue, clear the descriptors_ even if the Camera State is Stopped. As a drawback the libcamera::Camera::stop() function might be called twice, but this is allowed by the Camera state machine, and the second call is guaranteed to be a nop. Signed-off-by: Anle Pan Signed-off-by: Fang Hui Tested-by: Jacopo Mondi Reviewed-by: Jacopo Mondi Reviewed-by: Umang Jain Signed-off-by: Kieran Bingham --- src/android/camera_device.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index d2679a97..1b6f3f3a 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -433,8 +433,6 @@ void CameraDevice::flush() void CameraDevice::stop() { MutexLocker stateLock(stateMutex_); - if (state_ == State::Stopped) - return; camera_->stop(); -- cgit v1.2.1