ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
การส่งบัฟเฟอร์กล้องของผู้ผลิตรายเดียวไปยังผู้บริโภคหลายราย
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ฟีเจอร์นี้จะแนะนำชุดเมธอดที่ช่วยให้ไคลเอ็นต์กล้องเพิ่มและนำพื้นผิวเอาต์พุตออกแบบไดนามิกได้ขณะที่เซสชันการจับภาพทำงานอยู่และสตรีมมิงกล้องดำเนินอยู่ เอาต์พุตใหม่สามารถแมปกับสตรีมกล้องที่แชร์ที่ผู้ใช้เลือกได้ หลังจากเพิ่มพื้นผิวแล้ว คุณจะนําพื้นผิวนั้นออกได้ทุกเมื่อ
แนวคิดทั่วไปคือการแชร์บัฟเฟอร์ที่เชื่อมโยงกับสตรีมกล้องหนึ่งๆ ภายในแพลตฟอร์มเอาต์พุตหลายแพลตฟอร์ม ตัวนับการอ้างอิงภายในจะติดตามบัฟเฟอร์เมื่อพร้อมสําหรับการประมวลผลเพิ่มเติมฝั่งผู้บริโภค
เมื่อผู้บริโภคทั้งหมดทำงานที่เกี่ยวข้องเสร็จแล้ว ระบบจะนำบัฟเฟอร์ออกจากคิวและพร้อมใช้งานสำหรับกล้อง
รูปที่ 1 การแชร์บัฟเฟอร์
รูปที่ 1 แสดงตัวอย่างสถานการณ์หนึ่งที่บัฟเฟอร์ที่ประมวลผลโดยสตรีมกล้อง 2 จะได้รับการแนบและแยกออกแบบไดนามิก มีการนับการอ้างอิง และจัดการโดยคอมโพเนนต์ตัวแยกสตรีมภายในสตรีมเอาต์พุตที่แชร์โดยเฉพาะภายในบริการกล้อง
ตัวอย่างและแหล่งที่มา
การใช้งานหลักของฟีเจอร์นี้จะอยู่ในข้อบังคับของ
Camera3StreamSplitter
ข้อบังคับ ดูเอกสารประกอบเกี่ยวกับฟีเจอร์นี้ได้ในข้อมูลอ้างอิงสำหรับนักพัฒนาซอฟต์แวร์
การใช้งาน
ไม่จำเป็นต้องมีการติดตั้งใช้งานฝั่ง HAL ของกล้อง เนื่องจากฟีเจอร์นี้ติดตั้งใช้งานฝั่งเฟรมเวิร์ก
การตรวจสอบความถูกต้อง
การติดตั้งใช้งานต้องผ่านเคส CTS ที่ครอบคลุมฟีเจอร์นี้จากข้อบังคับของMultiViewTest และไลบรารี JNI เดิมสําหรับ API เดิม
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 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."]]