自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
通过 LE 音频实现头部追踪
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
蓝牙 (BT) 低功耗 (LE) 音频引入了适用于头部追踪 (HT) 数据的异步面向连接的逻辑 (LE-ACL) 和等时 (LE-ISO) 逻辑传输机制。
Android 15 支持根据使用的是 LE-ACL 还是 LE-ISO 传输机制来调整 HT 的延迟模式。
本页面介绍了音频框架、音频 HAL 和蓝牙堆栈如何相互交互,以发现并选择主机和耳机支持的 LE-ACL 或 LE-ISO 传输机制。
支持 LE-ACL 和 LE-ISO
Android 15 通过使用供应商定义的系统属性、音频 HAL 延迟模式和空间化程序连接模式,支持 LE-ACL 和 LE-ISO 传输机制。
系统属性
手机供应商实现在 bluetooth.core.le.dsa_transport_preference
系统属性中列出了支持的传输机制。该值是一个逗号分隔的字符串列表,按优先顺序列出了支持的传输方式:
le-acl
:LE-ACL 传输,当通过传感器堆栈报告惯性测量装置 (IMU) 数据时。
iso-hw
:ISO 传输,能够将 HT 数据直接从蓝牙控制器隧道式传输到音频 DSP 中的空间化程序。
iso-sw
:不具备隧道功能的 ISO 传输,当通过传感器堆栈报告 IMU 数据时。
延迟模式
对于 BT LE 音频,BT 堆栈向音频 HAL 和音频框架指明支持的延迟模式的机制与为传统 BT (A2DP) 定义的机制相同。音频 HAL 会根据当前选择的音频设备报告支持的延迟模式。
A2DP 实现仅支持 FREE
和 LOW_LATENCY
模式。
相比之下,对于 BT LE 音频,音频 HAL 中定义了以下延迟模式,以支持添加 LE-ACL 和 LE-ISO 传输机制:
FREE
:此值表示对于延迟时间,没有特定的限制。当不支持低延迟时间(由 HAL 指示)或 HT 处于非活动状态(由框架指示)时,使用此模式。
LOW
:此值表示与 HT 操作兼容的相对较低的延迟时间(例如,小于 100 毫秒)。当支持低延迟时间且 HID 通过 ACL 协议传输(由 HAL 指示)时,或当 HT 处于活动状态且没有其他低延迟模式可用(由框架指示)时,使用此模式。
DYNAMIC_SPATIAL_AUDIO_SOFTWARE
:当满足以下任一条件时,系统会使用此模式:
- 如果支持低延迟时间,HID 会通过 ISO 协议传输,并且 HID 无法隧道式传输到空间化程序效果引擎(由 HAL 指示)。
- 当音频框架向空间化程序效果引擎提供 HID 数据时,HT 处于活动状态且使用 ISO 协议(由框架指示)。
在此模式下,框架中的 HT 计算库会对 IMU 数据执行所有预处理,并与手机传感器指示的手机移动情况进行协调。
DYNAMIC_SPATIAL_AUDIO_HARDWARE
:当满足以下条件之一时,系统会使用此模式:
- 如果支持低延迟时间,HID 会通过 ISO 协议传输,并且 HID 可以隧道式传输到空间化程序效果引擎(由 HAL 指示)。
- 当 HT 处于活动状态且使用 ISO 协议时,HID 数据会被隧道式传输到空间化程序效果引擎(由框架指示)。
在此模式下,空间化程序效果引擎会直接从 BT 堆栈或 BT 控制器接收未处理的 IMU 数据。空间化程序效果实现会对 IMU 数据执行所有预处理,并与手机传感器指示的手机移动情况进行协调。
延迟模式枚举会映射到 Spatializer.cpp
中的 bluetooth.core.le.dsa_transport_preference
系统属性。
空间化程序支持
音频政策服务中的空间化程序控制器用于控制通过 LE 音频选择 HT 传输协议。空间化程序效果引擎实现表明其支持具有 HeadTracking.ConnectionMode
功能的 HT 数据隧道。
支持的 HT 连接模式如下:
FRAMEWORK_PROCESSED
:音频框架采用头部到舞台矢量格式,向 HAL 提供经过预处理的 IMU 数据。此默认模式与使用传统蓝牙的当前模式相对应。
DIRECT_TO_SENSOR_SW
:空间化程序效果引擎通过传感器软件堆栈直接连接到传感器。音频框架仅控制传感器的启用状态。不使用 AOSP libheadtracking
IMU 数据预处理或 DSP 分流空间化程序实现的软件实现可以使用 DIRECT_TO_SENSOR_SW
模式。
DIRECT_TO_SENSOR_TUNNEL
:空间化程序效果引擎通过硬件隧道直接连接到传感器。音频框架仅控制传感器的启用状态。DSP 分流的空间化程序实现可以使用 DIRECT_TO_SENSOR_TUNNEL
模式。
延迟模式选择
该框架从 HAL 报告的所支持的延迟模式列表中选择延迟模式。延迟模式的设置是基于当前的 HT 启用状态、当前的空间化程序支持以及供应商指定的系统属性(用于在传输机制之间建立优先级顺序)。
该框架在 selectHeadtrackingConnectionMode_l
中使用以下流程来选择延迟模式:
- 该框架从
bluetooth.core.le.dsa_transport_preference
系统属性加载传输优先级。
- 系统根据第 1 步中加载的列表过滤音频 HAL 报告的所支持的延迟模式,并对其进行排序。
- 如果最高优先级的低延迟模式为
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 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[[["易于理解","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"]],["最后更新时间 (UTC):2025-03-26。"],[],[],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."]]