Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Một nhà sản xuất, nhiều trình truyền tải vùng đệm máy ảnh của người dùng
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tính năng này giới thiệu một bộ phương thức cho phép ứng dụng máy ảnh thêm và xoá các nền tảng đầu ra một cách linh động trong khi phiên chụp đang hoạt động và quá trình truyền trực tuyến máy ảnh đang diễn ra. Đầu ra mới có thể liên kết với một luồng máy ảnh dùng chung cụ thể do người dùng chọn. Sau khi thêm một nền tảng, bạn có thể xoá nền tảng đó bất cứ lúc nào.
Ý tưởng chung là chia sẻ vùng đệm liên kết với một luồng máy ảnh cụ thể trong một số nền tảng đầu ra. Bộ đếm tham chiếu nội bộ theo dõi các vùng đệm khi chúng sẵn sàng để xử lý thêm ở phía người dùng.
Khi tất cả các trình tiêu thụ hoàn tất tác vụ tương ứng, vùng đệm sẽ được xoá khỏi hàng đợi và sẵn sàng cho máy ảnh.
Hình 1. Chia sẻ vùng đệm
Hình 1 mô tả một tình huống mẫu trong đó các vùng đệm do luồng máy ảnh 2 xử lý được đính kèm và tách rời một cách linh động, được tính số tham chiếu và quản lý bởi thành phần bộ chia luồng bên trong một luồng đầu ra dùng chung chuyên dụng trong dịch vụ máy ảnh.
Ví dụ và nguồn
Bạn có thể tìm thấy cách triển khai cốt lõi của tính năng này trong mô-đun Camera3StreamSplitter
. Bạn có thể xem tài liệu về tính năng này trong tài liệu tham khảo dành cho nhà phát triển:
Triển khai
Bạn không cần triển khai ở phía Camera HAL vì tính năng này được triển khai ở phía khung.
Xác nhận kết quả
Quá trình triển khai của bạn phải vượt qua các trường hợp CTS liên quan đến tính năng này từ mô-đun MultiViewTest và thư viện JNI gốc cho API gốc.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-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."]]