自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過 LE 音訊進行頭部追蹤
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
藍牙 (BT) 低功耗 (LE) 音訊引進非同步連線導向邏輯 (LE-ACL) 和等時 (LE-ISO) 邏輯傳輸機制,用於頭部追蹤 (HT) 資料。
Android 15 支援 HT 的延遲模式調整,這取決於是否使用 LE-ACL 或 LE-ISO 傳輸機制。
本頁說明音訊架構、音訊 HAL 和藍牙堆疊如何互動,以探索及選取主機和耳機支援的 LE-ACL 或 LE-ISO 傳輸機制。
支援 LE-ACL 和 LE-ISO
Android 15 支援 LE-ACL 和 LE-ISO 傳輸機制,方法是使用供應商定義的系統屬性、音訊 HAL 延遲模式和空間化器連線模式。
系統屬性
手機供應商實作項目會在 bluetooth.core.le.dsa_transport_preference
系統屬性中列出支援的傳輸機制。這個值是逗號分隔的字串清單,列出支援的傳輸方式,並依偏好順序排列:
le-acl
:當慣性測量單元 (IMU) 資料透過感應器堆疊回報時,則為 LE-ACL 傳輸。
iso-hw
:ISO 傳輸功能,可將 HT 資料直接從藍牙控制器傳送至音訊 DSP 中的空間化器。
iso-sw
:當 IMU 資料透過感應器堆疊回報時,沒有隧道功能的 ISO 傳輸。
延遲模式
在 BT LE 音訊的情況下,BT 堆疊向音訊 HAL 和音訊架構指出支援的延遲模式的機制,與為 BT Classic (A2DP) 定義的機制相同。音訊 HAL 會根據目前選取的音訊裝置,回報支援的延遲模式。
A2DP 實作項目僅支援 FREE
和 LOW_LATENCY
模式。
相反地,針對 BT LE 音訊,音訊 HAL 會定義下列延遲模式,以支援新增 LE-ACL 和 LE-ISO 傳輸機制:
FREE
:這個值表示延遲時間沒有特定限制。當系統不支援低延遲 (由 HAL 指出),或 HT 未啟用 (由架構指出) 時,就會使用這個模式。
LOW
:這個值表示延遲時間相對較短 (例如低於 100 毫秒),且與 HT 作業相容。當系統支援低延遲,且 HID 是透過 ACL 通訊協定傳送 (由 HAL 指示),或是 HT 處於啟用狀態,且沒有其他低延遲模式可用 (由架構指示) 時,就會使用這個模式。
DYNAMIC_SPATIAL_AUDIO_SOFTWARE
:在符合下列任一條件時,系統會使用這個模式:
- 當系統支援低延遲時,HID 會透過 ISO 通訊協定傳送,且無法將 HID 轉送至空間化效果引擎 (由 HAL 指出)。
- 當 HT 處於啟用狀態,且音訊架構在提供 HID 資料給空間化效果引擎時使用 ISO 通訊協定 (由架構指出)。
在這個模式中,架構中的 HT 運算程式庫會對 IMU 資料執行所有預先處理作業,並與手機感應器指示的手機動作進行調和。
DYNAMIC_SPATIAL_AUDIO_HARDWARE
:在符合下列任一條件時,系統會使用這個模式:
- 支援低延遲時,HID 會透過 ISO 通訊協定傳送,且 HID 可經由隧道傳送至空間化效果引擎 (由 HAL 指出)。
- 當 HT 處於活動狀態,且在將 HID 資料傳送至空間化效果引擎時使用 ISO 通訊協定 (由架構指出)。
在這個模式中,空間化效果引擎會直接從 BT 堆疊或 BT 控制器接收未經處理的 IMU 資料。空間化效果實作會對 IMU 資料執行所有預先處理作業,並與手機感應器所指示的手機動作進行調和。
延遲模式列舉會對應至 Spatializer.cpp
中的 bluetooth.core.le.dsa_transport_preference
系統屬性。
支援空間化器
音訊政策服務中的 spatializer 控制器會控管選取 HT 傳輸通訊協定,而非 LE 音訊。空間化效果引擎實作功能表示支援使用 HeadTracking.ConnectionMode
功能的 HT 資料通道。
支援的 HT 連線模式如下:
FRAMEWORK_PROCESSED
:音訊架構會以頭對頭向量格式,將經過預處理的 IMU 資料提供給 HAL。這個預設模式會與 BT 傳統模式的目前模式相對應。
DIRECT_TO_SENSOR_SW
:空間化效果引擎會透過感應器軟體堆疊直接連線至感應器。音訊架構只會控制感應器的啟用狀態。不使用 AOSP libheadtracking
IMU 資料預先處理或 DSP 卸載空間化器的軟體實作項目,可以使用 DIRECT_TO_SENSOR_SW
模式。
DIRECT_TO_SENSOR_TUNNEL
:空間化效果引擎會透過硬體通道直接連線至感應器。音訊架構只會控制感應器的啟用狀態。DSP 卸載的空間化器實作可使用 DIRECT_TO_SENSOR_TUNNEL
模式。
延遲模式選項
架構會從 HAL 回報的支援延遲模式清單中選取延遲模式。系統會根據目前的 HT 啟用狀態、目前的 spatializer 支援,以及供應商指定的系統屬性 (用於在傳輸機制之間建立優先順序),設定延遲模式。
架構會在 selectHeadtrackingConnectionMode_l
中使用下列程序選取延遲模式:
- 架構會從
bluetooth.core.le.dsa_transport_preference
系統屬性載入傳輸偏好設定。
- 系統會篩選音訊 HAL 回報的支援延遲模式,並根據步驟 1 載入的清單排序。
- 如果最高優先順序的低延遲模式為
iso-hw
,且空間化器實作支援直接感應器連線 (也就是 DIRECT_TO_SENSOR_SW
或 DIRECT_TO_SENSOR_TUNNEL
在空間化器中設定),則延遲模式會設為 DYNAMIC_SPATIAL_AUDIO_HARDWARE
。
如果最高優先順序的低延遲模式為 iso-hw
,且空間化器實作不支援直接感應器連線 (DIRECT_TO_SENSOR_SW
或 DIRECT_TO_SENSOR_TUNNEL
未在空間化器中設定),則下一個偏好模式 (iso-sw
或 le-acl
) 會決定延遲模式 (DYNAMIC_SPATIAL_AUDIO_SOFTWARE
或 LOW
)。
如果未指定下一個偏好模式,系統會回報產品設定錯誤。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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-27 (世界標準時間)。"],[],[],null,["# Head tracking over LE audio\n\n[Bluetooth (BT) Low Energy (LE) audio](https://www.bluetooth.com/specifications/core54-html/)\nintroduces the Asynchronous Connection-oriented Logical (LE-ACL) and Isochronous\n(LE-ISO) logical transport mechanisms for head tracking (HT) data.\n\nAndroid 15 provides support for latency mode\nadjustments for HT based on whether the LE-ACL or LE-ISO transport mechanism is\nused.\n\nThis page describes how the audio framework, audio HAL, and Bluetooth stack\ninteract to discover and select the LE-ACL or LE-ISO transport mechanisms\nsupported by the host and the headset.\n\nSupport for LE-ACL and LE-ISO\n-----------------------------\n\nAndroid 15 includes support for LE-ACL and LE-ISO\ntransport mechanisms by using a vendor-defined\n[system property](#ht-sys-prop), audio HAL [latency modes](#ht-latency-modes),\nand [spatializer connection modes](#ht-spatial-support).\n\n### System property\n\nThe phone vendor implementation lists the supported transport mechanisms in the\n[`bluetooth.core.le.dsa_transport_preference`](https://cs.android.com/android/platform/superproject/+/android-latest-release:system/libsysprop/srcs/android/sysprop/BluetoothProperties.sysprop;l=769) system property. The value is a comma-separated list of strings,\nlisting the [supported transports](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Bluetooth/system/bta/le_audio/le_audio_types.h;l=58) in the order of preference:\n\n- `le-acl`: LE-ACL transport, when the inertial measurement unit (IMU) data is reported through the sensor stack.\n- `iso-hw`: ISO transport with capability to tunnel HT data directly from the Bluetooth controller to the spatializer in the audio DSP.\n- `iso-sw`: ISO transport without tunneling capability, when the IMU data is reported through the sensor stack.\n\n### Latency modes\n\nIn the case of BT LE audio, the mechanism for the BT stack to indicate the\nsupported latency modes to the audio HAL and audio framework is the same as that\ndefined for BT Classic (A2DP). The audio HAL reports the supported latency modes\naccording to the currently selected audio device.\n\nA2DP implementations support only `FREE` and `LOW_LATENCY` modes.\n\nIn contrast, for BT LE audio, the following [latency modes](https://cs.android.com/android/platform/superproject/+/android-latest-release:system/hardware/interfaces/media/aidl/android/media/audio/common/AudioLatencyMode.aidl;l=27)\nare defined in the audio HAL to support the addition of LE-ACL and LE-ISO\ntransport mechanisms:\n\n- `FREE`: This value indicates that there's no specific constraint on the\n latency. This mode is used when low latency isn't supported (indicated by\n the HAL), or when HT isn't active (indicated by the framework).\n\n- `LOW`: This value indicates a relatively low latency (such as, less than\n 100 ms) compatible with HT operation. This mode is used when low\n latency is supported and HID is conveyed over the ACL protocol (indicated by\n the HAL), or when HT is active and no other low latency modes are available\n (indicated by the framework).\n\n- `DYNAMIC_SPATIAL_AUDIO_SOFTWARE`: This mode is used when one of the\n following conditions are met:\n\n - When low latency is supported, HID is conveyed over the ISO protocol, and HID can't be tunneled to the spatializer effect engine (indicated by the HAL).\n - When HT is active and the ISO protocol is used when the audio framework provides the HID data to the spatializer effect engine (indicated by the framework).\n\n In this mode, the HT computing library in the framework does all the\n preprocessing on the IMU data and reconciliation with phone movements\n indicated by phone sensors.\n- `DYNAMIC_SPATIAL_AUDIO_HARDWARE`: This mode is used when one of the\n following conditions are met:\n\n - When low latency is supported, HID is conveyed over the ISO protocol, and HID can be tunneled to the spatializer effect engine (indicated by the HAL).\n - When the HT active and the ISO protocol is used when the HID data is tunneled to the spatializer effect engine (indicated by the framework).\n\n In this mode, the spatializer effect engine receives the unprocessed IMU\n data directly from the BT stack or BT controller. The spatializer effect\n implementation does all the preprocessing on the IMU data and reconciliation\n with phone movements indicated by phone sensors.\n\nThe latency mode enums are mapped to the [`bluetooth.core.le.dsa_transport_preference`](https://cs.android.com/android/platform/superproject/+/android-latest-release:system/libsysprop/srcs/android/sysprop/BluetoothProperties.sysprop;l=769)\nsystem property in [`Spatializer.cpp`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/av/services/audiopolicy/service/Spatializer.cpp;l=218).\n\n### Spatializer support\n\nThe [spatializer](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/av/services/audiopolicy/service/Spatializer.cpp)\ncontroller in the audio policy service controls the selection of HT transport\nprotocol over LE audio. The spatializer effect engine implementation indicates\nsupport for HT data tunneling with the [`HeadTracking.ConnectionMode`](https://cs.android.com/android/platform/superproject/+/android-latest-release:system/hardware/interfaces/media/aidl/android/media/audio/common/HeadTracking.aidl;l=63) capability.\n\nThe supported HT connection modes are as follows:\n\n- `FRAMEWORK_PROCESSED`: The audio framework provides preprocessed IMU data in a head-to-stage vector format to HAL. This default mode corresponds to current mode with BT classic.\n- `DIRECT_TO_SENSOR_SW`: The spatializer effect engine directly connects to the sensor through the sensor software stack. The audio framework controls only the enabled state of the sensor. Software implementations that don't use the AOSP `libheadtracking` IMU data preprocessing or DSP offloaded spatializer implementations can use the `DIRECT_TO_SENSOR_SW` mode.\n- `DIRECT_TO_SENSOR_TUNNEL`: The spatializer effect engine directly connects to the sensor through hardware tunneling. The audio framework controls only the enabled state of the sensor. DSP offloaded spatializer implementations can use the `DIRECT_TO_SENSOR_TUNNEL` mode.\n\nLatency mode selection\n----------------------\n\nThe framework selects a latency mode from the list of supported\n[latency modes](#ht-latency-modes) that are reported by the HAL.\nThe [latency mode is set](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/av/services/audiopolicy/service/Spatializer.cpp;l=1056)\nbased on the current HT enable state, current [spatializer support](#ht-spatial-support),\nand the vendor-specified [system property](#ht-sys-prop) that\nestablishes a priority order between transport mechanisms.\n\nThe framework uses the following process in [`selectHeadtrackingConnectionMode_l`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/av/services/audiopolicy/service/Spatializer.cpp;l=1056)\nto select the latency mode:\n\n1. The framework loads the transport preference from the [`bluetooth.core.le.dsa_transport_preference`](https://cs.android.com/android/platform/superproject/+/android-latest-release:system/libsysprop/srcs/android/sysprop/BluetoothProperties.sysprop;l=769) [system property](#ht-sys-prop).\n2. The supported latency modes reported by the audio HAL are filtered and ordered against the list loaded in step 1.\n3. If the highest priority low latency mode is `iso-hw` and the spatializer implementation supports direct sensor connection (that is, `DIRECT_TO_SENSOR_SW` or `DIRECT_TO_SENSOR_TUNNEL` are set in the spatializer), the latency mode is set to `DYNAMIC_SPATIAL_AUDIO_HARDWARE`.\n4. If the highest priority low latency mode is `iso-hw` and the spatializer\n implementation doesn't support direct sensor connection (`DIRECT_TO_SENSOR_SW`\n or `DIRECT_TO_SENSOR_TUNNEL` aren't set in the spatializer), the next preferred\n mode (which is either `iso-sw` or `le-acl`) determines the latency mode (which\n is either `DYNAMIC_SPATIAL_AUDIO_SOFTWARE` or `LOW`).\n\n If the next preferred mode isn't specified, the system reports a product\n configuration error."]]