XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX 作 者:ZHS(文化人)
XX 联系方式:文章末尾Chat快问(或进群:471144274联系我)
XX 版权声明:原创文章,欢迎评论和转载~转载时能告诉我一声就最好了
XX 要说的话:作者水平有限,难免有不足之处,恳请指正!
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
写在前面:CSR的平台做Source,可以支持一拖二的场景;但在一拖二时两个从机必须配置为相同的codec,且只能为SBC, FASTSTREAM和 APTX其中一种。局限于平台的资源,一拖二时两个从机的声音会有不一致,一快一慢。
1、参考文档,第5章节有关dual stream的部分;
2、Source端会根据自身支持的codec,针对每一个从机协商出对应的codec类型,当两个从机协商的codec不一致时,就需要reconfig;原生代码中,重新配置时还是无法达到从机codec一致的结果,所以就会出现两个从机都没有声音或者一个从机没有声音的问题。如图
3、所以修改为下面这样,如图
此时配置过程和打印的log如下:
设备0:只能支持SBC
设备1:同时支持SBC、APTX、APTX-LL
设备0 设备1 状态 结果
第一次配置: 1 4 不同 没声音
第二次配置: 1 3 不同 没声音
第三次配置: 1 1 相同 有声音
bdaddr [0x2:0x5b:0xff04]
app memory =14
got free instance
A2DP: a2dp_start_connection bdaddr [0x2:0x5b:0xff04]
app memory =15
A2DP_INTERNAL_SIGNALLING_CONNECT_REQ:
inst[0x200f]
A2DP STATE: new state [Connecting Local]
A2DP_INTERNAL_MEDIA_SUSPEND_REQ:
inst[0x2000]
A2DP STATE: new state [Media Suspending Local]
A2DP CL_SDP_SERVICE_SEARCH_CFM status = 0
A2DP SDP ok, issue connect
A2DP_SIGNALLING_CONNECT_CFM 0:
instance from bdaddr
inst[0x200f]
device ID:[0x1]
A2DP STATE: new state [Connected Signalling]
bdaddr [0x2:0x5b:0xff04]
PS: Write new device - addr already exists as main device
A2DP_SIGNALLING_CONNECT_CFM 0:
instance from bdaddr
inst[0x200f]
A2DP MSG Ignored; state[3] inst[0x200f]
app memory =16
app memory =16
A2DP a2dp_route_all_audio Start ind = 0 ; statue1
A2DP a2dp_route_all_audio Start ind = 1 ; statue1
instance from bdaddr
A2DP SBC bitpool [48] bad_link_bitpool[48]
A2DP new role [0]
A2DP_INTERNAL_CONNECT_AUDIO_REQ:
inst[0x2000]
suspend: send media start
A2DP_INTERNAL_CONNECT_AUDIO_REQ:
inst[0x200f]
SetState conn_media_local
A2DP STATE: new state [Connecting Media Local]
A2DP: Preferred List:
ID:[0x4] Pref:[0x1]
ID:[0x3] Pref:[0x2]
ID:[0x1] Pref:[0x3]
A2DP: A2dpMediaOpenRequest True:
A2DP CL_DM_REMOTE_FEATURES_CFM
A2DP SBC bitpool [48] bad_link_bitpool[48]
A2DP link quality [3]
app memory =16
A2DP a2dp_route_all_audio Start ind = 0 ; statue1
A2DP a2dp_route_all_audio Start ind = 1 ; statue1
A2DP_INTERNAL_CONNECT_AUDIO_REQ:
inst[0x2000]
suspend: send media start
A2DP_INTERNAL_CONNECT_AUDIO_REQ:
inst[0x200f]
a2dp_msg_internal_connect_audio_req unhandled 4
A2DP MSG Ignored; state[4] inst[0x200f]
A2DP_MEDIA_OPEN_CFM 0:
instance from deviceID 1
inst[0x200f]
device ID:[0x1]
stream ID [0x0]
stream end point ID [0x4]
AUDIO: audio_a2dp_set_plugin [4]
A2DP STATE: new state [Connected Media]
&&&&&A2DP_INTERN 1 ,4:
&&&&&A2DP_INTERN xcscAL_MEDIA_CLOSE_REQ:
&&&&&A2DP_INTERN xcscAL_MEDIA_CLOSE_REQ:
A2DP_INTERNAL_MEDIA_CLOSE_REQ:
inst[0x2000]
A2DP STATE: new state [Disconnecting Media]
A2DP_INTERNAL_MEDIA_CLOSE_REQ:
inst[0x200f]
A2DP STATE: new state [Disconnecting Media]
A2DP_MEDIA_CLOSE_IND:
instance from deviceID 1
inst[0x200f]
A2DP STATE: new state [Connected Signalling]
A2DP_INTERNAL_MEDIA_OPEN_REQ:
inst[0x200f]
A2DP STATE: new state [Connecting Media Local]
A2DP: Preferred List:
ID:[0x3] Pref:[0x1]
ID:[0x1] Pref:[0x2]
A2DP: A2dpMediaOpenRequest True:
A2DP_MEDIA_CLOSE_IND:
instance from deviceID 0
inst[0x2000]
A2DP STATE: new state [Connected Signalling]
A2DP_INTERNAL_MEDIA_START_REQ:
inst[0x2000]
A2DP MSG Ignored; state[3] inst[0x2000]
A2DP_INTERNAL_MEDIA_START_REQ:
inst[0x2000]
A2DP MSG Ignored; state[3] inst[0x2000]
A2DP_SIGNALLING_DISCONNECT_IND:
instance from deviceID 0
inst[0x2000]
A2DP: a2dp_init_instance inst[0x2000]
A2DP STATE: new state [Disconnected]
AUDIO: Switch Audio Mode
app memory =16
app memory =15
app memory =16
bdaddr [0x2:0x5b:0xff04]
A2DP_MEDIA_OPEN_CFM 0:
instance from deviceID 1
inst[0x200f]
device ID:[0x1]
stream ID [0x0]
stream end point ID [0x3]
AUDIO: audio_a2dp_set_plugin [3]
A2DP STATE: new state [Connected Media]
A2DP_INTERNAL_MEDIA_START_REQ:
inst[0x200f]
A2DP STATE: new state [Media Starting Local]
A2DP_MEDIA_START_CFM 0:
instance from deviceID 1
inst[0x200f]
A2DP STATE: new state [Media Streaming]
AUDIO: audio_a2dp_connect
audio_routed [0] input_source [0x2ea5] input_sink [0x0] a2dp_sink_0 [0x0] a2dp_sink_1 [0xba7f]
codec ; voice_rate[0x0] packet_size[0x29c] bitpool[0x0] format[0x0]
PS: Write new device - addr already exists as main device
bdaddr [0xfc58:0xfa:0x3111b9]
bdaddr [0xfc58:0xfa:0x3111b9]
PS: Write new device - addr already exists as 2nd device
app memory =15
A2DP_SIGNALLING_CONNECT_IND:
got free instance
inst[0x2000]
bdaddr [0xfc58:0xfa:0x3111b9]
A2DP STATE: new state [Connecting Remote]
bdaddr [0xfc58:0xfa:0x3111b9]
accept = 1
A2DP_SIGNALLING_CONNECT_CFM 0:
instance from bdaddr
inst[0x2000]
device ID:[0x0]
A2DP STATE: new state [Connected Signalling]
bdaddr [0xfc58:0xfa:0x3111b9]
PS: Write new device - addr already exists as 2nd device
app memory =15
instance from bdaddr
A2DP new role [1]
A2DP CL_DM_REMOTE_FEATURES_CFM
A2DP link quality [3]
app memory =15
A2DP a2dp_route_all_audio Start ind = 0 ; statue1
A2DP a2dp_route_all_audio Start ind = 1 ; statue1
instance from bdaddr
A2DP new role [0]
A2DP_INTERNAL_CONNECT_AUDIO_REQ:
inst[0x2000]
SetState conn_media_local
A2DP STATE: new state [Connecting Media Local]
A2DP: Preferred List:
ID:[0x4] Pref:[0x1]
ID:[0x3] Pref:[0x2]
ID:[0x1] Pref:[0x3]
A2DP: A2dpMediaOpenRequest True:
A2DP_INTERNAL_CONNECT_AUDIO_REQ:
inst[0x200f]
media streaming
A2DP_MEDIA_OPEN_CFM 0:
instance from deviceID 0
inst[0x2000]
device ID:[0x0]
stream ID [0x0]
stream end point ID [0x1]
AUDIO: audio_a2dp_set_plugin [1]
A2DP STATE: new state [Connected Media]
&&&&&A2DP_INTERN 1 ,3:
&&&&&A2DP_INTERN xcscAL_MEDIA_CLOSE_REQ:
&&&&&A2DP_INTERN xcscAL_MEDIA_CLOSE_REQ:
A2DP_INTERNAL_MEDIA_CLOSE_REQ:
inst[0x2000]
A2DP STATE: new state [Disconnecting Media]
A2DP_INTERNAL_MEDIA_CLOSE_REQ:
inst[0x200f]
A2DP STATE: new state [Disconnecting Media]
bdaddr [0xfc58:0xfa:0x3111b9]
A2DP_MEDIA_CLOSE_IND:
instance from deviceID 0
inst[0x2000]
A2DP STATE: new state [Connected Signalling]
A2DP_INTERNAL_MEDIA_OPEN_REQ:
inst[0x2000]
A2DP STATE: new state [Connecting Media Local]
A2DP: Preferred List:
ID:[0x3] Pref:[0x1]
ID:[0x1] Pref:[0x2]
A2DP: A2dpMediaOpenRequest True:
A2DP_MEDIA_CLOSE_IND:
instance from deviceID 1
inst[0x200f]
A2DP STATE: new state [Connected Signalling]
A2DP_INTERNAL_MEDIA_OPEN_REQ:
inst[0x200f]
A2DP STATE: new state [Connecting Media Local]
A2DP: Preferred List:
ID:[0x1] Pref:[0x1]
A2DP: A2dpMediaOpenRequest True:
A2DP_MEDIA_OPEN_CFM 0:
instance from deviceID 0
inst[0x2000]
device ID:[0x0]
stream ID [0x0]
stream end point ID [0x1]
AUDIO: audio_a2dp_set_plugin [1]
A2DP STATE: new state [Connected Media]
A2DP_INTERNAL_MEDIA_START_REQ:
inst[0x2000]
A2DP STATE: new state [Media Starting Local]
A2DP_MEDIA_START_CFM 0:
instance from deviceID 0
inst[0x2000]
A2DP STATE: new state [Media Streaming]
AUDIO: audio_a2dp_connect
audio_routed [0] input_source [0x2ea5] input_sink [0x0] a2dp_sink_0 [0xba72] a2dp_sink_1 [0x0]
codec ; voice_rate[0x0] packet_size[0x29c] bitpool[0x30] format[0xfd]
A2DP SBC bitpool [48] bad_link_bitpool[48]
PS: Write new device - addr already exists as 2nd device
A2DP_MEDIA_OPEN_CFM 0:
instance from deviceID 1
inst[0x200f]
device ID:[0x1]
stream ID [0x0]
stream end point ID [0x1]
AUDIO: audio_a2dp_set_plugin [1]
A2DP STATE: new state [Connected Media]
&&&&&A2DP_INTERN 1 ,1:
A2DP_INTERNAL_MEDIA_START_REQ:
inst[0x200f]
A2DP STATE: new state [Media Starting Local]
A2DP_MEDIA_START_CFM 0:
instance from deviceID 1
inst[0x200f]
A2DP STATE: new state [Media Streaming]
&&&&&A2DP_INTERN 1 ,1:
AUDIO: audio_a2dp_connect
A2DP SBC bitpool [48] bad_link_bitpool[48]
audio_routed [1] connect_sink [0xba6e] bitpool [48] bad_link_bitpool [48]
PS: Write new device - addr already exists as main device