Session Parameters

The session parameters feature reduces delays by enabling camera clients to actively configure the subset of costly request parameters, i.e. session parameters, as part of the capture session initialization phase. With this feature, your HAL implementations receive the client parameters during the stream configuration phase instead of the first capture request and can, depending on their values, prepare and build the internal pipeline more efficiently.

Examples and source

A reference session parameter implementation is already part of the CameraHal. This HAL uses the legacy Hal API. The binderized CameraHal that implements the camera HIDL API must use the respective HIDL sessionParams entry to access any new incoming session parameters during stream configuration.

Camera clients can query the keys of all supported session parameters by calling getAvailableSessionKeys() and eventually set their initial values via setSessionParameters().

Implementation

Your CameraHal implementation must populate the ANDROID_REQUEST_AVAILABLE_SESSION_KEYS within the respective static camera metadata and provide a subset of ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, which contains a list of keys that are difficult to apply per-frame and can result in unexpected delays when modified during the capture session lifetime.

Typical examples include parameters that require a time-consuming hardware reconfiguration or an internal camera pipeline change. Control over session parameters can still be exerted in capture requests but clients should be aware of and expect delays in their application.

The framework monitors all incoming requests and if it detects a change in the value of a session parameter, it internally reconfigures the camera. The new stream configuration passed to CameraHal then includes the updated session parameter values, which are used to configure the camera pipeline more efficiently.

Customization

You can define tags in the available session parameter list that is populated on the CameraHal side. This feature is not active if CameraHal leaves the available session parameter list empty.

Validation

CTS includes the following new cases for testing session parameters:

In general, once a certain parameter is part of the session key list, its current value is included as part of the session parameters passed during stream configuration at the HAL layer.

Session parameters must be carefully selected. The values should not change frequently, if at all, between stream configurations. Parameters that change frequently, such as capture intent, are ill-suited and adding them to the session parameter list could cause CTS failures due to excessive internal re-configuration.