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 <anle.pan@nxp.com>
Signed-off-by: Fang Hui <hui.fang@nxp.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Anle Pan 2024-04-04 12:18:14 +02:00 committed by Kieran Bingham
parent 503c3a838a
commit fb74bb7df6

View file

@ -433,8 +433,6 @@ void CameraDevice::flush()
void CameraDevice::stop()
{
MutexLocker stateLock(stateMutex_);
if (state_ == State::Stopped)
return;
camera_->stop();