Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Single producer, multiple consumer camera buffer transport
Stay organized with collections
Save and categorize content based on your preferences.
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.
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-06-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-18 UTC."],[],[],null,["# Single producer, multiple consumer camera buffer transport\n\nThis feature introduces a set of methods that allows camera clients to add and\nremove output surfaces dynamically while the capture session is active and\ncamera streaming is ongoing. A new output can map to a specific, user-selected\n[shared camera](https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#enableSurfaceSharing())\nstream. After a surface is added, it can be removed at any time.\n\nThe general idea is to share the buffers associated with a particular camera\nstream within several output surfaces. An internal reference counter keeps track\nof the buffers as they become ready for further processing on the consumer side.\nWhen all consumers complete their respective tasks the buffer gets dequeued and\nis available for the camera.\n\n**Figure 1.** Buffer sharing\n\nFigure 1 depicts one example scenario where the buffers processed by camera\nstream 2 are dynamically attached and detached, reference counted, and managed\nby the stream splitter component inside a dedicated shared output stream within\nthe camera service.\n\nExamples and source\n-------------------\n\nThe core implementation of this feature can be found in the\n[`Camera3StreamSplitter`](https://android.googlesource.com/platform/frameworks/av/+/android16-release/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp)\nmodule. Documentation on this feature can be found in the developer reference:\n\n- [`updateOutputConfiguration()`](https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration))\n- [`addSurface()`](https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#addSurface(android.view.Surface))\n- [`removeSurface()`](https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration#removeSurface(android.view.Surface))\n\nImplementation\n--------------\n\nNo implementation is required on the Camera HAL side as this feature is\nimplemented on the framework side.\n\nValidation\n----------\n\nYour implementation must pass CTS cases that cover this feature from the\n[MultiViewTest](https://android.googlesource.com/platform/cts/+/android16-release/tests/camera/src/android/hardware/camera2/cts/MultiViewTest.java)\nmodule and the\n[native JNI library](https://android.googlesource.com/platform/cts/+/android16-release/tests/camera/libctscamera2jni/native-camera-jni.cpp)\nfor the native API."]]