diff --git a/core/api/current.txt b/core/api/current.txt index fa65288409abd..d589a27e4e379 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -17787,6 +17787,7 @@ package android.hardware.camera2 { method public void onCaptureSequenceAborted(@NonNull android.hardware.camera2.CameraCaptureSession, int); method public void onCaptureSequenceCompleted(@NonNull android.hardware.camera2.CameraCaptureSession, int, long); method public void onCaptureStarted(@NonNull android.hardware.camera2.CameraCaptureSession, @NonNull android.hardware.camera2.CaptureRequest, long, long); + method public void onReadoutStarted(@NonNull android.hardware.camera2.CameraCaptureSession, @NonNull android.hardware.camera2.CaptureRequest, long, long); } public abstract static class CameraCaptureSession.StateCallback { @@ -18780,6 +18781,7 @@ package android.hardware.camera2.params { method public int getSurfaceGroupId(); method @NonNull public java.util.List getSurfaces(); method public int getTimestampBase(); + method public boolean isReadoutTimestampUsed(); method public void removeSensorPixelModeUsed(int); method public void removeSurface(@NonNull android.view.Surface); method public void setDynamicRangeProfile(long); @@ -18787,6 +18789,7 @@ package android.hardware.camera2.params { method public void setPhysicalCameraId(@Nullable String); method public void setStreamUseCase(long); method public void setTimestampBase(int); + method public void useReadoutTimestamp(boolean); method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator CREATOR; field public static final int MIRROR_MODE_AUTO = 0; // 0x0 diff --git a/core/java/android/hardware/camera2/CameraCaptureSession.java b/core/java/android/hardware/camera2/CameraCaptureSession.java index 8e4a10879ce51..ff6e8975f8daf 100644 --- a/core/java/android/hardware/camera2/CameraCaptureSession.java +++ b/core/java/android/hardware/camera2/CameraCaptureSession.java @@ -1245,10 +1245,28 @@ public abstract class CameraCaptureSession implements AutoCloseable { * the start of exposure, particularly when autoexposure is changing exposure duration * between frames.

* - *

This timestamp may not match {@link CaptureResult#SENSOR_TIMESTAMP the result - * timestamp field}. It will, however, match the timestamp of buffers sent to the - * output surfaces with {@link OutputConfiguration#TIMESTAMP_BASE_READOUT_SENSOR} - * timestamp base.

+ *

The timestamps match the timestamps of the output surfaces with readout timestamp + * enabled (via {@link OutputConfiguration#useReadoutTimestamp}) if:

+ * + *

Otherwise, the timestamps won't match the timestamp of the output surfaces. See + * the possible parameters for {@link OutputConfiguration#setTimestampBase} for details.

* *

This callback will be called only if {@link * CameraCharacteristics#SENSOR_READOUT_TIMESTAMP} is @@ -1261,8 +1279,6 @@ public abstract class CameraCaptureSession implements AutoCloseable { * the timestamp at the input image's start of readout for a * reprocess request, in nanoseconds. * @param frameNumber the frame number for this capture - * - * @hide */ public void onReadoutStarted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, long timestamp, long frameNumber) { diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index a6f7e945bef80..320af06f34a33 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -4588,22 +4588,26 @@ public final class CameraCharacteristics extends CameraMetadataWhether or not the camera device supports readout timestamp and - * onReadoutStarted callback.

- *

If this tag is HARDWARE, the camera device calls onReadoutStarted in addition to the - * onCaptureStarted callback for each capture. The timestamp passed into the callback - * is the start of camera image readout rather than the start of the exposure. In - * addition, the application can configure an - * {@link android.hardware.camera2.params.OutputConfiguration } with - * TIMESTAMP_BASE_READOUT_SENSOR timestamp base, in which case, the timestamp of the - * output surface matches the timestamp from the corresponding onReadoutStarted callback.

+ * {@code onReadoutStarted} callback.

+ *

If this tag is {@code HARDWARE}, the camera device calls + * {@link CameraCaptureSession.CaptureCallback#onReadoutStarted } in addition to the + * {@link CameraCaptureSession.CaptureCallback#onCaptureStarted } callback for each capture. + * The timestamp passed into the callback is the start of camera image readout rather than + * the start of the exposure. The timestamp source of + * {@link CameraCaptureSession.CaptureCallback#onReadoutStarted } is the same as that of + * {@link CameraCaptureSession.CaptureCallback#onCaptureStarted }.

+ *

In addition, the application can switch an output surface's timestamp from start of + * exposure to start of readout by calling + * {@link android.hardware.camera2.params.OutputConfiguration#useReadoutTimestamp }.

*

The readout timestamp is beneficial for video recording, because the encoder favors * uniform timestamps, and the readout timestamps better reflect the cadence camera sensors * output data.

- *

If this tag is HARDWARE, the camera device produces the start-of-exposure and - * start-of-readout together. As a result, the onReadoutStarted is called right after - * onCaptureStarted. The difference in start-of-readout and start-of-exposure is the sensor - * exposure time, plus certain constant offset. The offset is usually due to camera sensor - * level crop, and it remains constant for a given camera sensor mode.

+ *

Note that the camera device produces the start-of-exposure and start-of-readout callbacks + * together. As a result, the {@link CameraCaptureSession.CaptureCallback#onReadoutStarted } + * is called right after {@link CameraCaptureSession.CaptureCallback#onCaptureStarted }. The + * difference in start-of-readout and start-of-exposure is the sensor exposure time, plus + * certain constant offset. The offset is usually due to camera sensor level crop, and it is + * generally constant over time for the same set of output resolutions and capture settings.

*

Possible values:

*