bt_slience_detect.c
static void a2dp_slience_detect(void *_detect);
有BT_STATUS_A2DP_MEDIA_START命令,并且发送命令的地址和当前地址(正在播歌)不同,启动能量检测:
能量检测命令发送:
能量检测:
static void tws_a2dp_play_in_task(u8 *data)
正常一般会有以下三条log打印
bt_start_a2dp_slience_detect, 297 g_dual_detect->is_receive_avrcp_play_cmd = 0 //第一次,收到avrcp播放命令的蓝牙设备地址a2dp_avrcp_play_cmd_addr还没复制过来
a2dp_slience_detect, 188 g_dual_detect->is_receive_avrcp_play_cmd = 1 // 如果没有收到avrcp的播放命令,则延长能量检测时间
抢占,把正在播歌的设备(被抢占的设备)mute住,对被抢占的设备进行能量检测
bt_start_a2dp_slience_detect, 297 g_dual_detect->is_receive_avrcp_play_cmd = 0
抢占,挂起被抢占的设备,暂停被抢占的设备
bt_stop_a2dp_slience_detect //停止能量检测
流程结束(另一台设备挂起,释放mute),会unmute,恢复数据包
CMD_A2DP_MUTE //抢占,把正在播歌的设备mute住
36 09 1E 3C FF 28 //被抢占的设备地址
conn->core.a2dp_mute=1 //释放解码流,没设备播歌
bt_start_a2dp_slience_detect: //能量检测,把被抢占的设备mute住,会有对这个设备的能量检测
36 09 1E 3C FF 28 //被抢占的设备地址
bt_start_a2dp_slience_detect, 297 g_dual_detect->is_receive_avrcp_play_cmd = 0 //是否收到avrcp的播放命令
app_msg_bt_a2dp_play
“(设备B)要播歌的远端设备地址”
conn->core.a2dp_mute=0 //有设备要播歌
........
挂起、暂停被抢占的设备
bt_stop_a2dp_slience_detect //停止能量检测
conn->core.a2dp_mute=0 //有设备播歌