Camera3: Use proper timestamp clock domain for different streams
If buffer consumers assume different clock domain compared to the camera
output, camera3 device uses the offset between the clock domains to convert
the timestamp.
Bug: 27153476
Change-Id: Iaae33281411cb27b639e87b0dad957d640182898
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index f70a153..3848200 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -23,6 +23,7 @@
#include <utils/Mutex.h>
#include <utils/Thread.h>
#include <utils/KeyedVector.h>
+#include <utils/Timers.h>
#include <hardware/camera3.h>
#include <camera/CaptureResult.h>
#include <camera/camera2/ICameraDeviceUser.h>
@@ -251,6 +252,12 @@
/**** End scope for mLock ****/
+ // The offset converting from clock domain of other subsystem
+ // (video/hardware composer) to that of camera. Assumption is that this
+ // offset won't change during the life cycle of the camera device. In other
+ // words, camera device shouldn't be open during CPU suspend.
+ nsecs_t mTimestampOffset;
+
typedef struct AeTriggerCancelOverride {
bool applyAeLock;
uint8_t aeLock;
@@ -392,6 +399,12 @@
*/
Size getMaxJpegResolution() const;
+ /**
+ * Helper function to get the offset between MONOTONIC and BOOTTIME
+ * timestamp.
+ */
+ static nsecs_t getMonoToBoottimeOffset();
+
struct RequestTrigger {
// Metadata tag number, e.g. android.control.aePrecaptureTrigger
uint32_t metadataTag;