Share via


CameraCaptureSession.CaptureCallback.OnReadoutStarted Method

Definition

This method is called when the camera device has started reading out the output image for the request, at the beginning of the sensor image readout.

[Android.Runtime.Register("onReadoutStarted", "(Landroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;JJ)V", "GetOnReadoutStarted_Landroid_hardware_camera2_CameraCaptureSession_Landroid_hardware_camera2_CaptureRequest_JJHandler", ApiSince=34)]
public virtual void OnReadoutStarted (Android.Hardware.Camera2.CameraCaptureSession session, Android.Hardware.Camera2.CaptureRequest request, long timestamp, long frameNumber);
[<Android.Runtime.Register("onReadoutStarted", "(Landroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;JJ)V", "GetOnReadoutStarted_Landroid_hardware_camera2_CameraCaptureSession_Landroid_hardware_camera2_CaptureRequest_JJHandler", ApiSince=34)>]
abstract member OnReadoutStarted : Android.Hardware.Camera2.CameraCaptureSession * Android.Hardware.Camera2.CaptureRequest * int64 * int64 -> unit
override this.OnReadoutStarted : Android.Hardware.Camera2.CameraCaptureSession * Android.Hardware.Camera2.CaptureRequest * int64 * int64 -> unit

Parameters

session
CameraCaptureSession

the session returned by CameraDevice#createCaptureSession

request
CaptureRequest

the request for the readout that just began

timestamp
Int64

the timestamp at start of readout for a regular request, or the timestamp at the input image's start of readout for a reprocess request, in nanoseconds.

frameNumber
Int64

the frame number for this capture

Attributes

Remarks

This method is called when the camera device has started reading out the output image for the request, at the beginning of the sensor image readout.

For a capture request, this callback is invoked right after #onCaptureStarted. Unlike #onCaptureStarted, instead of passing a timestamp of start of exposure, this callback passes a timestamp of start of camera data readout. This is useful because for a camera running at fixed frame rate, the start of readout is at fixed interval, which is not necessarily true for the start of exposure, particularly when autoexposure is changing exposure duration between frames.

The timestamps match the timestamps of the output surfaces with readout timestamp enabled (via OutputConfiguration#setReadoutTimestampEnabled) if:

<ul> <li> Timestamp base is OutputConfiguration#TIMESTAMP_BASE_DEFAULT and the output <ul> <li> is not a SurfaceView surface, and </li> <li> is not a MediaRecoder, MediaCodec, or ImageReader surface with android.hardware.HardwareBuffer#USAGE_VIDEO_ENCODE usage flag or the device's CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE is UNKNOWN</li> </ul> </li> <li> Timestamp base is OutputConfiguration#TIMESTAMP_BASE_SENSOR,</li> <li> Timestamp base is OutputConfiguration#TIMESTAMP_BASE_MONOTONIC and the device's CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE is UNKNOWN,</li> <li> Timestamp base is OutputConfiguration#TIMESTAMP_BASE_REALTIME and the device's CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE is REALTIME</li> </ul>

Otherwise, the timestamps won't match the timestamp of the output surfaces. See the possible parameters for OutputConfiguration#setTimestampBase for details.

This callback will be called only if CameraCharacteristics#SENSOR_READOUT_TIMESTAMP is CameraMetadata#SENSOR_READOUT_TIMESTAMP_HARDWARE, and it's called right after #onCaptureStarted.

Java documentation for android.hardware.camera2.CameraCaptureSession.CaptureCallback.onReadoutStarted(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, long, long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to