4

全志T113芯片蓝牙音乐播放失败如何解决?

 1 year ago
source link: https://blog.51cto.com/u_15380233/6003656
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

全志T113芯片蓝牙音乐播放失败如何解决?

精选 原创

神棍地海棠 2023-01-12 10:14:38 ©著作权

文章标签 bc #define ci 文章分类 嵌入式Linux 嵌入式 阅读数149

1.主题

T113-S3 蓝牙音乐播放失败问题

2.问题背景

硬件:T113 + XR829
软件:Linux(非Tina)

3.问题描述

3.1复现步骤

#驱动路径要根据固件实际路径
insmod /lib/modules/5.4.61±ab179/xradio_btlpm.ko

等驱动安装完再执行后续操作
echo 0 > /sys/class/rfkill/rfkill0/state
sleep 1
echo 1 > /sys/class/rfkill/rfkill0/state
sleep 1

hciattach -n ttyS1 xradio &

hciconfig hci0 up
hciconfig hci0 piscan

#启动蓝牙协议栈
bluetoothd -n &

#设定本机为播放源
bluealsa -p a2dp-source &

#进入蓝牙控制终端
bluetoothctl

#扫描周边蓝牙设备
scan on
#若例表中已找到设备则手动停止扫描
scan off
#连接蓝牙音箱
connect <蓝牙音箱MAC>

连接成功提示Device 30:21:23:6F:18:E2 Connected: yes

#退出bluetoothctl
exit

#播放音乐aplay -D bluealsa:DEV=音箱mac 音乐文件路径
aplay -D bluealsa:DEV=30:21:23:6F:18:E2 /a.wav &

3.2具体表现

蓝牙音乐播放失败,并且出现蓝牙设备断开现象

4.问题分析

1、对比R328等Tina平台,以上的验证方法没有问题,bluez 和 bluealsa版本也一致,因此判断不是操作或者版本本身的问题。
2、由于蓝牙已经断开,查看进程情况,通过PS命令,看出Bluetoothd进程还在,但是bluealsa进程已经退出。
3、加打印分析bluealsa退出点,经过验证是在SBC编码环节。
4、排查SBC编码的代码,发现程序在某个点会崩溃。
5、在网上查找相关案例,疑似与编译配置有关系。

5.根本原因

与SBC编译的配置有关系,在当前的编译工具链环境下,需要打开 --enable-high-precision配置

6.解决办法

如下修改配置:

  • 修改sbc_primitives.h
diff --git a/sbc/sbc_primitives.h b/sbc/sbc_primitives.h
index e01c957..b060484 100644
--- a/sbc/sbc_primitives.h
+++ b/sbc/sbc_primitives.h
@@ -27,6 +27,10 @@
 #ifndef __SBC_PRIMITIVES_H
 #define __SBC_PRIMITIVES_H

+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #define SCALE_OUT_BITS 15
 #define SBC_X_BUFFER_SIZE 328
  • 在sbc.mk中增加
SBC_CONF_OPTS = --enable-high-precision
  • 收藏
  • 评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK