2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
単一のプロデューサ、複数コンシューマ カメラのバッファ トランスポート
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
この機能により、キャプチャ セッションがアクティブでカメラ ストリーミングが進行中に、カメラ クライアントが出力サーフェスを動的に追加または削除できる、一連のメソッドが導入されます。新しい出力は、ユーザーが選択した特定の共有カメラ ストリームにマッピングできます。追加したサーフェスは、いつでも削除できます。
これは一般的に、特定のカメラ ストリームに関連するバッファを複数の出力サーフェスで共有することを目的としています。内部参照カウンタは、コンシューマー側で次の処理を行う準備ができるまでバッファを追跡します。すべてのコンシューマーがそれぞれのタスクを完了すると、バッファはキューから除外され、カメラで使用できるようになります。
図 1. バッファ共有
図 1 はシナリオの一例を示しています。カメラサービスの専用共有出力ストリーム内にあるストリーム分割コンポーネントが、カメラ ストリーム 2 によって処理されたバッファに対して、動的な接続または接続解除、参照カウント、管理を行います。
例とソース
この機能のコア実装は、Camera3StreamSplitter
モジュールにあります。この機能に関するドキュメントは、次のデベロッパー ガイドにあります。
実装
この機能はフレームワーク側で実装されるため、Camera HAL 側で実装する必要はありません。
検証
実装は、MultiViewTest モジュールとネイティブ API 用のネイティブ JNI ライブラリの、この機能をカバーする CTS ケースにパスする必要があります。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[null,null,["最終更新日 2025-03-26 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."]]