From f09a4cdbd658bdfeca05f8f43fe3d7cb85d35440 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Thu, 25 Jun 2020 15:12:34 -0700 Subject: [PATCH] Camera: Clarify timestamp behavior for VIDEO_RECORD usage flag Test: make docs and read the doc Bug: 143240912 Change-Id: I64032c7e2644680888979696968bdebd772530cc --- media/java/android/media/ImageReader.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/media/java/android/media/ImageReader.java b/media/java/android/media/ImageReader.java index ba87f2bbffb57..87c3bb9ffabe1 100644 --- a/media/java/android/media/ImageReader.java +++ b/media/java/android/media/ImageReader.java @@ -200,6 +200,20 @@ public class ImageReader implements AutoCloseable { * * Using other combinations may result in {@link IllegalArgumentException}. *

+ *

+ * If the {@link ImageReader} is used as an output target for a {@link + * android.hardware.camera2.CameraDevice}, and if the usage flag contains + * {@link HardwareBuffer#USAGE_VIDEO_ENCODE}, the timestamps of the + * {@link Image images} produced by the {@link ImageReader} won't be in the same timebase as + * {@link android.os.SystemClock#elapsedRealtimeNanos}, even if + * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE} is + * {@link android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME}. + * Instead, the timestamps will be roughly in the same timebase as in + * {@link android.os.SystemClock#uptimeMillis}, so that A/V synchronization could work for + * video recording. In this case, the timestamps from the {@link ImageReader} with + * {@link HardwareBuffer#USAGE_VIDEO_ENCODE} usage flag may not be directly comparable with + * timestamps of other streams or capture result metadata. + *

* @param width The default width in pixels of the Images that this reader will produce. * @param height The default height in pixels of the Images that this reader will produce. * @param format The format of the Image that this reader will produce. This must be one of the