summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng Gu <gucheng@google.com>2022-07-20 22:32:43 +0000
committerCheng Gu <gucheng@google.com>2022-07-25 22:20:00 +0000
commitd4e30d375014c26e7ece64a2978d2d06d58f294e (patch)
tree73ad5bc6d88b235e6b493447eee6f8ba3d5665cb
parent1ef0944f5b16d877116844634bb75a2499fb6114 (diff)
downloadcamera-d4e30d375014c26e7ece64a2978d2d06d58f294e.tar.gz
realtime_zsl: Return result if a metadata error is notified later
This commit fixes a corner case when buffer has arrived OK but a metadata is notified with error. Previously, the buffer would still be blocked in `pending_request` due to `AllDataCollected()` not being met. This commit gives it a chance to call `process_capture_result_()` from `Notify()` if necessary. Bug: 235371520 Test: Framework stress test, CTS Change-Id: I1cf6a401864808a73dc9e87db6d13a27b7746a95
-rw-r--r--common/hal/google_camera_hal/realtime_zsl_result_request_processor.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/hal/google_camera_hal/realtime_zsl_result_request_processor.cc b/common/hal/google_camera_hal/realtime_zsl_result_request_processor.cc
index d65d9f0..8edc17d 100644
--- a/common/hal/google_camera_hal/realtime_zsl_result_request_processor.cc
+++ b/common/hal/google_camera_hal/realtime_zsl_result_request_processor.cc
@@ -327,6 +327,21 @@ void RealtimeZslResultRequestProcessor::Notify(
.partial_results_received++;
}
}
+ // Gives latched results (those that have arrived but are waiting for
+ // AllDataCollected()) a chance to return their valid buffer.
+ uint32_t frame_number = message.message.error.frame_number;
+ auto result = std::make_unique<CaptureResult>();
+ result->frame_number = frame_number;
+ if (pending_frame_number_to_requests_.find(frame_number) !=
+ pending_frame_number_to_requests_.end()) {
+ RequestEntry& pending_request =
+ pending_frame_number_to_requests_[frame_number];
+ if (pending_request.zsl_buffer_received) {
+ ReturnResultDirectlyForFramesWithErrorsLocked(
+ pending_error_frames_[frame_number], pending_request,
+ std::move(result));
+ }
+ }
} else {
// May change to ALOGD for per-frame shutter messages.
ALOGV(
@@ -395,6 +410,8 @@ void RealtimeZslResultRequestProcessor::ReturnResultDirectlyForFramesWithErrorsL
result->result_metadata == nullptr && result->output_buffers.size() == 0) {
return;
}
+ ALOGV("%s: Returning capture result for frame %d due to existing errors.",
+ __FUNCTION__, result->frame_number);
process_capture_result_(std::move(result));
return;
}