CameraConstrainedHighSpeedCaptureSession


public abstract class CameraConstrainedHighSpeedCaptureSession
extends CameraCaptureSession

java.lang.Object
   ↳ android.hardware.camera2.CameraCaptureSession
     ↳ android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession


A constrained high speed capture session for a CameraDevice, used for capturing high speed images from the CameraDevice for high speed video recording use case.

A CameraConstrainedHighSpeedCaptureSession is created by providing a session configuration to CameraDevice.createCaptureSession(SessionConfiguration) with a type of SessionConfiguration.SESSION_HIGH_SPEED. The CameraCaptureSession returned from CameraCaptureSession.StateCallback can then be cast to a CameraConstrainedHighSpeedCaptureSession. Once created, the session is active until a new session is created by the camera device, or the camera device is closed.

An active high speed capture session is a specialized capture session that is only targeted at high speed video recording (>=120fps) use case if the camera device supports high speed video capability (i.e., CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES contains CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO). It only accepts request lists created via createHighSpeedRequestList(CaptureRequest), and the request list can only be submitted to this session via captureBurst, or setRepeatingBurst. See CameraDevice.createCaptureSession(android.hardware.camera2.params.SessionConfiguration) for more details of the limitations.

Creating a session is an expensive operation and can take several hundred milliseconds, since it requires configuring the camera device's internal pipelines and allocating memory buffers for sending images to the desired targets. Therefore the setup is done asynchronously, and CameraDevice.createConstrainedHighSpeedCaptureSession will send the ready-to-use CameraCaptureSession to the provided listener's CameraCaptureSession.StateCallback.onConfigured callback. If configuration cannot be completed, then the CameraCaptureSession.StateCallback.onConfigureFailed is called, and the session will not become active.

If a new session is created by the camera device, then the previous session is closed, and its associated onClosed callback will be invoked. All of the session methods will throw an IllegalStateException if called once the session is closed.

A closed session clears any repeating requests (as if CameraCaptureSession.stopRepeating() had been called), but will still complete all of its in-progress capture requests as normal, before a newly created session takes over and reconfigures the camera device.

Summary

Public methods

abstract List<CaptureRequest> createHighSpeedRequestList(CaptureRequest request)

Create a unmodifiable list of requests that is suitable for constrained high speed capture session streaming.

Inherited methods

abstract void abortCaptures()

Discard all captures currently pending and in-progress as fast as possible.

abstract int capture(CaptureRequest request, CameraCaptureSession.CaptureCallback listener, Handler handler)

Submit a request for an image to be captured by the camera device.

abstract int captureBurst(List<CaptureRequest> requests, CameraCaptureSession.CaptureCallback listener, Handler handler)

Submit a list of requests to be captured in sequence as a burst.

int captureBurstRequests(List<CaptureRequest> requests, Executor executor, CameraCaptureSession.CaptureCallback listener)

Submit a list of requests to be captured in sequence as a burst.

int captureSingleRequest(CaptureRequest request, Executor executor, CameraCaptureSession.CaptureCallback listener)

Submit a request for an image to be captured by the camera device.

abstract void close()

Close this capture session asynchronously.

abstract void finalizeOutputConfigurations(List<OutputConfiguration> outputConfigs)

Finalize the output configurations that now have their deferred and/or extra Surfaces included.

abstract CameraDevice getDevice()

Get the camera device that this session is created for.

abstract Surface getInputSurface()

Get the input Surface associated with a reprocessable capture session.

abstract boolean isReprocessable()

Return if the application can submit reprocess capture requests with this camera capture session.

abstract void prepare(Surface surface)

Pre-allocate all buffers for an output Surface.

abstract int setRepeatingBurst(List<CaptureRequest> requests, CameraCaptureSession.CaptureCallback listener, Handler handler)

Request endlessly repeating capture of a sequence of images by this capture session.

int setRepeatingBurstRequests(List<CaptureRequest> requests, Executor executor, CameraCaptureSession.CaptureCallback listener)

Request endlessly repeating capture of a sequence of images by this capture session.

abstract int setRepeatingRequest(CaptureRequest request, CameraCaptureSession.CaptureCallback listener, Handler handler)

Request endlessly repeating capture of images by this capture session.

int setSingleRepeatingRequest(CaptureRequest request, Executor executor, CameraCaptureSession.CaptureCallback listener)

Request endlessly repeating capture of images by this capture session.

abstract void stopRepeating()

Cancel any ongoing repeating capture set by either setRepeatingRequest or setRepeatingBurst(List, CaptureCallback, Handler).

boolean supportsOfflineProcessing(Surface surface)

Query whether a given Surface is able to support offline mode.

CameraOfflineSession switchToOffline(Collection<Surface> offlineSurfaces, Executor executor, CameraOfflineSession.CameraOfflineSessionCallback listener)

Switch the current capture session and a given set of registered camera surfaces to offline processing mode.

void updateOutputConfiguration(OutputConfiguration config)

Update OutputConfiguration after configuration finalization see finalizeOutputConfigurations(List).

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

abstract void close()

Closes this resource, relinquishing any underlying resources.

Public constructors

CameraConstrainedHighSpeedCaptureSession

public CameraConstrainedHighSpeedCaptureSession ()

Public methods

createHighSpeedRequestList

Added in API level 23
public abstract List<CaptureRequest> createHighSpeedRequestList (CaptureRequest request)

Create a unmodifiable list of requests that is suitable for constrained high speed capture session streaming.

High speed video streaming creates significant performance pressure on the camera device, so to achieve efficient high speed streaming, the camera device may have to aggregate multiple frames together. This means requests must be sent in batched groups, with all requests sharing the same settings. This method takes the list of output target Surfaces (subject to the output Surface requirements specified by the constrained high speed session) and a request, and generates a request list that has the same controls for each request. The input request must contain the target output Surfaces and target high speed FPS range that is one of the StreamConfigurationMap.getHighSpeedVideoFpsRangesFor for the Surface size.

If both preview and recording Surfaces are specified in the request, the target FPS range in the input request must be a fixed frame rate FPS range, where the minimal FPS == maximum FPS. The created request list will contain a interleaved request pattern such that the preview output FPS is at least 30fps, the recording output FPS is maximum FPS of the requested FPS range. The application can submit this request list directly to an active high speed capture session to achieve high speed video recording. When only preview or recording Surface is specified, this method will return a list of request that have the same controls and output targets for all requests.

Submitting a request list created by this method to a normal capture session will result in an IllegalArgumentException if the high speed FPS range is not supported by CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES.

Parameters
request CaptureRequest: The high speed capture request that will be used to generate the high speed request list. This value cannot be null.

Returns
List<CaptureRequest> A unmodifiable CaptureRequest list that is suitable for constrained high speed capture. This value cannot be null.

Throws
IllegalArgumentException if the set of output Surfaces in the request do not meet the high speed video capability requirements, or the camera device doesn't support high speed video capability, or the request doesn't meet the high speed video capability requirements, or the request doesn't contain the required controls for high speed capture.
CameraAccessException if the camera device is no longer connected or has encountered a fatal error
IllegalStateException if the camera device has been closed