Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/hardware/camera2/CameraConstrainedHighSpeedCaptureSession#pubctors) \| [Methods](https://developer.android.com/reference/android/hardware/camera2/CameraConstrainedHighSpeedCaptureSession#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/camera2/CameraConstrainedHighSpeedCaptureSession#inhmethods)

# CameraConstrainedHighSpeedCaptureSession

*** ** * ** ***

` public abstract class CameraConstrainedHighSpeedCaptureSession `   
` ` ` extends https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession ` ` `

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.hardware.camera2.CameraCaptureSession](https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession) ||
|   | ↳ | android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession |

<br />

*** ** * ** ***

A constrained high speed capture session for a `https://developer.android.com/reference/android/hardware/camera2/CameraDevice`, used for capturing high speed images from the `https://developer.android.com/reference/android/hardware/camera2/CameraDevice` for high speed video recording use case.

A CameraConstrainedHighSpeedCaptureSession is created by providing a session configuration to `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)` with a type of `https://developer.android.com/reference/android/hardware/camera2/params/SessionConfiguration#SESSION_HIGH_SPEED`. The CameraCaptureSession returned from `https://developer.android.com/reference/android/hardware/camera2/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., `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES` contains `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO`). It only accepts request lists created via `https://developer.android.com/reference/android/hardware/camera2/CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList(android.hardware.camera2.CaptureRequest)`, and the request list can only be submitted to this session via `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#captureBurst(java.util.List<android.hardware.camera2.CaptureRequest>,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)`. See `https://developer.android.com/reference/android/hardware/camera2/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 `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createConstrainedHighSpeedCaptureSession(java.util.List<android.view.Surface>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)` will send the ready-to-use CameraCaptureSession to the provided listener's `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback#onConfigured(android.hardware.camera2.CameraCaptureSession)` callback. If configuration cannot be completed, then the `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback#onConfigureFailed(android.hardware.camera2.CameraCaptureSession)` 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 `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback#onClosed(android.hardware.camera2.CameraCaptureSession)` 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 `https://developer.android.com/reference/android/hardware/camera2/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.

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/hardware/camera2/CameraConstrainedHighSpeedCaptureSession#CameraConstrainedHighSpeedCaptureSession()() ` |

| ### Public methods ||
|---|---|
| ` abstract https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest>` | ` https://developer.android.com/reference/android/hardware/camera2/CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList(android.hardware.camera2.CaptureRequest)(https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request) ` <br /> Create a unmodifiable list of requests that is suitable for constrained high speed capture session streaming. |

### Inherited methods

From class ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession ` ` abstract void` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#abortCaptures()() `

Discard all captures currently pending and in-progress as fast as possible.
` abstract int` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#capture(android.hardware.camera2.CaptureRequest,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)(https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener, https://developer.android.com/reference/android/os/Handler handler) `

<br />

Submit a request for an image to be captured by the camera device.
` abstract int` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#captureBurst(java.util.List<android.hardware.camera2.CaptureRequest>,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest> requests, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener, https://developer.android.com/reference/android/os/Handler handler) `

Submit a list of requests to be captured in sequence as a burst.
` int` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#captureBurstRequests(java.util.List<android.hardware.camera2.CaptureRequest>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest> requests, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener) `

Submit a list of requests to be captured in sequence as a burst.
` int` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#captureSingleRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback)(https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener) `

<br />

Submit a request for an image to be captured by the camera device.
` abstract void` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#close()() `

Close this capture session asynchronously.
` abstract void` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration> outputConfigs) `

<br />

Finalize the output configurations that now have their deferred and/or extra Surfaces included.
` abstract https://developer.android.com/reference/android/hardware/camera2/CameraDevice` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#getDevice()() `

Get the camera device that this session is created for.
` abstract https://developer.android.com/reference/android/view/Surface` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#getInputSurface()() `

Get the input Surface associated with a reprocessable capture session.
` abstract boolean` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#isReprocessable()() `

Return if the application can submit reprocess capture requests with this camera capture session.
` abstract void` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#prepare(android.view.Surface)(https://developer.android.com/reference/android/view/Surface surface) `

<br />

Pre-allocate all buffers for an output Surface.
` abstract int` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest> requests, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener, https://developer.android.com/reference/android/os/Handler handler) `

<br />

Request endlessly repeating capture of a sequence of images by this capture session.
` int` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingBurstRequests(java.util.List<android.hardware.camera2.CaptureRequest>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest> requests, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener) `

<br />

Request endlessly repeating capture of a sequence of images by this capture session.
` abstract int` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)(https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener, https://developer.android.com/reference/android/os/Handler handler) `

Request endlessly repeating capture of images by this capture session.
` int` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setSingleRepeatingRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback)(https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener) `

Request endlessly repeating capture of images by this capture session.
` abstract void` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#stopRepeating()() `

<br />

Cancel any ongoing repeating capture set by either `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)` or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)`.
` boolean` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#supportsOfflineProcessing(android.view.Surface)(https://developer.android.com/reference/android/view/Surface surface) `

<br />

Query whether a given Surface is able to support offline mode.
` https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#switchToOffline(java.util.Collection<android.view.Surface>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)(https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/view/Surface> offlineSurfaces, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback listener) `

Switch the current capture session and a given set of registered camera surfaces to offline processing mode.
` void` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)(https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration config) `

Update `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` after configuration finalization see `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)`.
` void` ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration> configurations) `

Update the output configurations for this camera session.
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(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` ` https://developer.android.com/reference/java/lang/Object#wait(long)(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` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/java/lang/AutoCloseable ` ` abstract void` ` https://developer.android.com/reference/java/lang/AutoCloseable#close()() `

Closes this resource, relinquishing any underlying resources.

## Public constructors

### CameraConstrainedHighSpeedCaptureSession

```
public CameraConstrainedHighSpeedCaptureSession ()
```

<br />

<br />

## Public methods

### createHighSpeedRequestList

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract List<CaptureRequest> createHighSpeedRequestList (CaptureRequest request)
```

<br />

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 `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest`, and generates a request list that has the same controls for each request. The input `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest` must contain the target output Surfaces and target high speed FPS range that is one of the `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap#getHighSpeedVideoFpsRangesFor(android.util.Size)` for the Surface size.

If both preview and recording Surfaces are specified in the `request`, the `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE` in the input `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest` must be a fixed frame rate FPS range, where the `https://developer.android.com/reference/android/util/Range#getLower()` == `https://developer.android.com/reference/android/util/Range#getUpper()`. 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 `https://developer.android.com/reference/android/util/Range#getUpper()` 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 `https://developer.android.com/reference/java/lang/IllegalArgumentException` if the high speed `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE` is not supported by `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES`.

<br />

<br />

| Parameters ||
|---|---|
| `request` | `CaptureRequest`: The high speed capture request that will be used to generate the high speed request list. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest>` | A unmodifiable CaptureRequest list that is suitable for constrained high speed capture. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraAccessException` | if the camera device is no longer connected or has encountered a fatal error |
| `https://developer.android.com/reference/java/lang/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. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if the camera device has been closed |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createConstrainedHighSpeedCaptureSession(java.util.List<android.view.Surface>,%20android.hardware.camera2.CameraCaptureSession.StateCallback,%20android.os.Handler)`
- `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE`
- `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap#getHighSpeedVideoSizes()`
- `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap#getHighSpeedVideoFpsRangesFor(android.util.Size)`
- `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES`
- `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO`