QCamera2/HAL3: Set timestamps in private display metadata
Set the timestamp in display metadata so that clients aware of
private_handle such as VT can use this un-modified timestamps.
Camera framework is unaware of this timestamp and cannot
modify this.
Bug: 30411594
Change-Id: I21eada8c6a56d5a014525fdc271e258a256b4ee9
diff --git a/QCamera2/HAL3/QCamera3HWI.cpp b/QCamera2/HAL3/QCamera3HWI.cpp
index 7b84814..92429a8 100644
--- a/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/QCamera2/HAL3/QCamera3HWI.cpp
@@ -1272,6 +1272,37 @@
}
}
+/*==============================================================================
+ * FUNCTION : updateTimeStampInPendingBuffers
+ *
+ * DESCRIPTION: update timestamp in display metadata for all pending buffers
+ * of a frame number
+ *
+ * PARAMETERS :
+ * @frame_number: frame_number. Timestamp will be set on pending buffers of this frame number
+ * @timestamp : timestamp to be set
+ *
+ * RETURN : None
+ *
+ *==========================================================================*/
+void QCamera3HardwareInterface::updateTimeStampInPendingBuffers(
+ uint32_t frameNumber, nsecs_t timestamp)
+{
+ for (auto req = mPendingBuffersMap.mPendingBuffersInRequest.begin();
+ req != mPendingBuffersMap.mPendingBuffersInRequest.end(); req++) {
+ if (req->frame_number != frameNumber)
+ continue;
+
+ for (auto k = req->mPendingBufferList.begin();
+ k != req->mPendingBufferList.end(); k++ ) {
+ struct private_handle_t *priv_handle =
+ (struct private_handle_t *) (*(k->buffer));
+ setMetaData(priv_handle, SET_VT_TIMESTAMP, ×tamp);
+ }
+ }
+ return;
+}
+
/*===========================================================================
* FUNCTION : configureStreams
*
@@ -3032,6 +3063,11 @@
i->timestamp = capture_time;
+ /* Set the timestamp in display metadata so that clients aware of
+ private_handle such as VT can use this un-modified timestamps.
+ Camera framework is unaware of this timestamp and cannot change this */
+ updateTimeStampInPendingBuffers(i->frame_number, i->timestamp);
+
// Find channel requiring metadata, meaning internal offline postprocess
// is needed.
//TODO: for now, we don't support two streams requiring metadata at the same time.
@@ -3129,6 +3165,7 @@
j->buffer = NULL;
}
}
+
result.output_buffers = result_buffers;
mCallbackOps->process_capture_result(mCallbackOps, &result);
LOGD("meta frame_number = %u, capture_time = %lld",
diff --git a/QCamera2/HAL3/QCamera3HWI.h b/QCamera2/HAL3/QCamera3HWI.h
index 6c884d5..3e32d39 100644
--- a/QCamera2/HAL3/QCamera3HWI.h
+++ b/QCamera2/HAL3/QCamera3HWI.h
@@ -316,6 +316,7 @@
void addToPPFeatureMask(int stream_format, uint32_t stream_idx);
void updateFpsInPreviewBuffer(metadata_buffer_t *metadata, uint32_t frame_number);
+ void updateTimeStampInPendingBuffers(uint32_t frameNumber, nsecs_t timestamp);
void enablePowerHint();
void disablePowerHint();