Oreo对A2DP codec的支持

Android Oreo增强了A2DP编码支持,包括SBC、AAC、APTX和LDAC。编码的选择取决于设备能力和配置文件的优先级。在Java层,Bluetooth.apk的A2dpStateMachine初始化编码支持。在C++层,BT stack初始化codec并根据双方设备的能力和优先级选择合适的编码。目前,Oreo默认支持SBC,新增编码主要用于source,如APTX和LDAC需要特定平台支持。
摘要由CSDN通过智能技术生成

除了使用HIDL来区分蓝牙的公共stack和vendor lib,Oreo对蓝牙A2DP的支持也更加全面。除了A2DP profile强制支持的SBC,Oreo新增了对AAC、APTX、LDAC的编码定义。具体是否支持,还得看实现。这里简单说明Oreo是如何做到支持多种编码,并选择合适的编码方式的。

 

Java world的声明

codec的支持是A2DP profile的声明的。在Bluetooth.apk中,编码的支持包含在A2dpStateMachine当中。它在自己的构造函数中对编码的支持进行了初始化:

    private A2dpStateMachine(A2dpService svc, Context context) {
        //......
        mCodecConfigPriorities = assignCodecConfigPriorities();
        initNative(mCodecConfigPriorities);
        //......
    }

assignCodecConfigPriorities的作用是,首先加载各个codec的priority,再将每个支持的codec参数初始化。codec的priority保存在配置文件values/config.xml中。就目前的设置来看,它支持五种编码:

    <!-- Configuring priorities of A2DP source codecs. Larger value means
         higher priority. Value -1 means the codec is disabled.
         Value 0 is reserved and should not be used here. Enabled codecs
         should have priorities in the interval [1, 999999], and each priority
         value should be unique. -->
    <integer name="a2dp_source_codec_priority_sbc">1001</integer>
    <integer name="
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值