From a86d281e52c772c4d40c6b9578c1eec8de8c5ca2 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Tue, 4 May 2021 16:02:33 +0200 Subject: android: Rework request completion notification The current implementation of CameraDevice::requestComplete() which handles event notification and calls the framework capture result callback does not handle error notification precisely enough. In detail: - Error notification is an asynchronous callback that has to be notified to the framework as soon as an error condition is detected, and it independent from the process_capture_result() callback - Error notification requires the HAL to report the precise error cause, by specifying the correct CAMERA3_MSG_ERROR_* error code. The current implementation only notifies errors of type CAMERA3_MSG_ERROR_REQUEST at the end of the procedure, before the callback invocation. Rework the procedure to: - Notify CAMERA3_MSG_ERROR_DEVICE and perform library tear-down in case a Fatal error is detected - Notify CAMERA3_MSG_ERROR_REQUEST if the libcamera::Request::status is different than RequestCompleted and immediately call process_capture_result() with all buffers in error state. - Notify the shutter event as soon as possible - Notify CAMERA3_MSG_ERROR_RESULT in case the metadata cannot be generated correctly and call process_capture_result() with the right buffer state regardless of metadata availability. - Notify CAMERA3_MSG_ERROR_BUFFER for buffers whose post-processing failed While at it, return the CameraStream buffer by calling cameraStream->putBuffer() regardless of the post-processing result. No regression detected when running CTS in LIMITED mode. Signed-off-by: Jacopo Mondi Reviewed-by: Hirokazu Honda Reviewed-by: Laurent Pinchart --- src/android/camera_device.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/android/camera_device.h') diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 8190d929..decf1754 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -101,7 +101,8 @@ private: libcamera::FrameBuffer *createFrameBuffer(const buffer_handle_t camera3buffer); void notifyShutter(uint32_t frameNumber, uint64_t timestamp); - void notifyError(uint32_t frameNumber, camera3_stream_t *stream); + void notifyError(uint32_t frameNumber, camera3_stream_t *stream, + camera3_error_msg_code code); std::unique_ptr requestTemplatePreview(); std::unique_ptr requestTemplateVideo(); libcamera::PixelFormat toPixelFormat(int format) const; -- cgit v1.2.1