Camera: Try to remove inflight requests during error notifications
Make it possible for clients to clear the internal inflight queue
as part of error result notifications. For this to work all pending
buffers must be returned previously with the exception of the
result metadata.
Bug: 35652756
Test: Complete Camera/Camera2 CTS without any regressions.
Change-Id: I9d8a6b63364fd254311cda2f8c836b99ee05cacb
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index 1de2edc..93d3d7f 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -2934,6 +2934,13 @@
InFlightRequest &r = mInFlightMap.editValueAt(idx);
r.requestStatus = msg.error_code;
resultExtras = r.resultExtras;
+ if (hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_RESULT ==
+ errorCode) {
+ // In case of missing result check whether the buffers
+ // returned. If they returned, then remove inflight
+ // request.
+ removeInFlightRequestIfReadyLocked(idx);
+ }
} else {
resultExtras.frameNumber = msg.frame_number;
ALOGE("Camera %s: %s: cannot find in-flight request on "