Single producer, multiple consumer camera buffer transport

This feature introduces a set of methods that allows camera clients to add and remove output surfaces dynamically while the capture session is active and camera streaming is ongoing. A new output can map to a specific, user-selected shared camera stream. After a surface is added, it can be removed at any time.

The general idea is to share the buffers associated with a particular camera stream within several output surfaces. An internal reference counter keeps track of the buffers as they become ready for further processing on the consumer side. When all consumers complete their respective tasks the buffer gets dequeued and is available for the camera.

Buffer sharing

Figure 1. Buffer sharing

Figure 1 depicts one example scenario where the buffers processed by camera stream 2 are dynamically attached and detached, reference counted, and managed by the stream splitter component inside a dedicated shared output stream within the camera service.

Examples and source

The core implementation of this feature can be found in the Camera3StreamSplitter module. Documentation on this feature can be found in the developer reference:

Implementation

No implementation is required on the Camera HAL side as this feature is implemented on the framework side.

Validation

Your implementation must pass CTS cases that cover this feature from the MultiViewTest module and the native JNI library for the native API.