diff options
-rw-r--r-- | camera/QCamera2/HAL3/QCamera3HWI.cpp | 40 | ||||
-rw-r--r-- | camera/QCamera2/HAL3/QCamera3HWI.h | 4 |
2 files changed, 43 insertions, 1 deletions
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp index 4e785f6..e5926fd 100644 --- a/camera/QCamera2/HAL3/QCamera3HWI.cpp +++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp @@ -1293,6 +1293,39 @@ void QCamera3HardwareInterface::updateFpsInPreviewBuffer(metadata_buffer_t *meta } } +#ifndef USE_HAL_3_3 +/*============================================================================== + * 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; +} +#endif + /*=========================================================================== * FUNCTION : configureStreams * @@ -3017,6 +3050,13 @@ void QCamera3HardwareInterface::handleMetadataWithLock( i->timestamp = capture_time; +#ifndef USE_HAL_3_3 + /* 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); +#endif + // 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. diff --git a/camera/QCamera2/HAL3/QCamera3HWI.h b/camera/QCamera2/HAL3/QCamera3HWI.h index 47df2be..b093996 100644 --- a/camera/QCamera2/HAL3/QCamera3HWI.h +++ b/camera/QCamera2/HAL3/QCamera3HWI.h @@ -320,7 +320,9 @@ private: void addToPPFeatureMask(int stream_format, uint32_t stream_idx); void updateFpsInPreviewBuffer(metadata_buffer_t *metadata, uint32_t frame_number); - +#ifndef USE_HAL_3_3 + void updateTimeStampInPendingBuffers(uint32_t frameNumber, nsecs_t timestamp); +#endif void enablePowerHint(); void disablePowerHint(); int32_t dynamicUpdateMetaStreamInfo(); |