Camera3: Do not allow dropped metadata
It's a fatal error to drop metadata. Because if a metadata is
dropped, there will be incomplete process_capture_result.
BUG=24497512
Ack by: shuzhenw
Change-Id: I349336fd2d2f2c2cc80b29846408fb5d5c91ce38
diff --git a/QCamera2/HAL3/QCamera3HWI.cpp b/QCamera2/HAL3/QCamera3HWI.cpp
index 18b401e..aeda643 100644
--- a/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/QCamera2/HAL3/QCamera3HWI.cpp
@@ -2519,14 +2519,13 @@
* 1. have a pending reprocess request or
* 2. miss a metadata buffer callback */
if (i->frame_number < frame_number) {
- /* Clear notify_msg structure */
- camera3_notify_msg_t notify_msg;
- memset(¬ify_msg, 0, sizeof(camera3_notify_msg_t));
- notify_msg.type = CAMERA3_MSG_SHUTTER;
- notify_msg.message.shutter.frame_number = i->frame_number;
- notify_msg.message.shutter.timestamp = (uint64_t)capture_time -
- (urgent_frame_number - i->frame_number) * NSEC_PER_33MSEC;
if (i->input_buffer) {
+ /* Clear notify_msg structure */
+ camera3_notify_msg_t notify_msg;
+ memset(¬ify_msg, 0, sizeof(camera3_notify_msg_t));
+ notify_msg.type = CAMERA3_MSG_SHUTTER;
+ notify_msg.message.shutter.frame_number = i->frame_number;
+
i->partial_result_cnt++; //input request will not have urgent metadata
CameraMetadata settings;
if(i->settings) {
@@ -2546,19 +2545,24 @@
result.partial_result = i->partial_result_cnt;
CDBG("%s: Input request metadata notify frame_number = %u, capture_time = %llu",
__func__, i->frame_number, notify_msg.message.shutter.timestamp);
+ mCallbackOps->notify(mCallbackOps, ¬ify_msg);
+ i->timestamp = (nsecs_t)notify_msg.message.shutter.timestamp;
+ CDBG("%s: Support notification !!!! notify frame_number = %u, capture_time = %llu",
+ __func__, i->frame_number, notify_msg.message.shutter.timestamp);
+
} else {
- mPendingLiveRequest--;
- CameraMetadata dummyMetadata;
- dummyMetadata.update(ANDROID_SENSOR_TIMESTAMP,
- &i->timestamp, 1);
- dummyMetadata.update(ANDROID_REQUEST_ID,
- &(i->request_id), 1);
- result.result = dummyMetadata.release();
+ ALOGE("%s: Fatal: Missing metadata buffer for frame number %d", __func__, i->frame_number);
+ if (free_and_bufdone_meta_buf) {
+ mMetadataChannel->bufDone(metadata_buf);
+ free(metadata_buf);
+ }
+ camera3_notify_msg_t notify_msg;
+ memset(¬ify_msg, 0, sizeof(notify_msg));
+ notify_msg.type = CAMERA3_MSG_ERROR;
+ notify_msg.message.error.error_code = CAMERA3_MSG_ERROR_DEVICE;
+ mCallbackOps->notify(mCallbackOps, ¬ify_msg);
+ goto done_metadata;
}
- mCallbackOps->notify(mCallbackOps, ¬ify_msg);
- i->timestamp = (nsecs_t)notify_msg.message.shutter.timestamp;
- CDBG("%s: Support notification !!!! notify frame_number = %u, capture_time = %llu",
- __func__, i->frame_number, notify_msg.message.shutter.timestamp);
} else {
mPendingLiveRequest--;
/* Clear notify_msg structure */