Moving on and getting more technical, I did a new logcat using the actual Zoom app as a test. This is the output:
Code:
05-18 12:01:10.825 537 3053 D BluetoothHeadset: startScoUsingVirtualVoiceCall()
05-18 12:01:10.828 647 919 I bt_hci_audio: set_audio_state handle:1 codec:0x1 state:3
05-18 12:01:10.828 647 919 D bt_hwcfg: hw_set_SCO_codec 0x1
05-18 12:01:10.833 647 896 I bt_hwcfg: SCO I2S interface change the sample rate to 8K
05-18 12:01:10.833 647 896 I bt_hwcfg: I2SPCM config {0x1, 0x1, 0x0, 0x1}
05-18 12:01:10.841 647 896 I bt_hwcfg: sco I2S/PCM config result 0 [0-Success, 1-Fail]
05-18 12:01:10.841 647 896 I bt_vendor: sco_audiostate_cb(status: 0)
05-18 12:01:10.894 647 919 W bt_btm : BTM Remote does not support 3-EDR eSCO
05-18 12:01:10.916 647 930 D HeadsetStateMachine: Set NREC: 1 for device:00:11:67:BD:2B:8E
05-18 12:01:10.917 238 634 I bt_a2dp_hw: adev_set_parameters: state 5
05-18 12:01:10.917 238 634 I bt_a2dp_hw: out_set_parameters: state 5
05-18 12:01:10.917 238 634 I hash_map_utils: key: 'bt_headset_nrec' value: 'on'
05-18 12:01:10.921 238 238 I bt_a2dp_hw: adev_set_parameters: state 5
05-18 12:01:10.921 238 238 I bt_a2dp_hw: out_set_parameters: state 5
05-18 12:01:10.921 238 238 I hash_map_utils: key: 'bt_headset_name' value: 'JBL E25BT'
05-18 12:01:10.925 537 537 I Telecom : : mReceiver: HEADSET_AUDIO_STATE_CHANGED_ACTION: BM.oR@ACo
05-18 12:01:10.925 537 537 I Telecom : : ==> new state: 12: BM.oR@ACo
05-18 12:01:10.930 537 877 I Telecom : CallAudioRouteStateMachine: Message received: SWITCH_BLUETOOTH=1002, arg1=0: BM.oR->CARSM.pM_SWITCH_BLUETOOTH@ACo_0
05-18 12:01:11.892 238 317 D audio_hw_primary: select_output_device: AUDIO_DEVICE_OUT_ALL
05-18 12:01:12.065 238 4760 I audio_hw_primary: in_reconfigure_channels: config_changed 0 effect 0x0
05-18 12:01:12.069 238 4760 D audio_hw_primary: select_input_device: AUDIO_DEVICE_IN_DEFAULT
05-18 12:01:12.245 238 4760 D audio_hw_primary: select_input_device: AUDIO_DEVICE_IN_DEFAULT
05-18 12:01:12.424 238 317 D AudioFlinger: mixer(0xacc83f40) throttle end: throttle time(11)
05-18 12:01:12.506 238 317 D AudioFlinger: mixer(0xacc83f40) throttle end: throttle time(54)
05-18 12:01:12.614 238 317 D AudioFlinger: mixer(0xacc83f40) throttle end: throttle time(52)
05-18 12:01:17.955 647 919 E bt_btif : bta_dm_pm_btm_status hci_status=36
It seems like the Bluetooth driver is correctly negotiating the codecs and SCO (voice) modes. The things that caught my attention are the device selections, after the device has been set up:
05-18 12:01:11.892 238 317 D audio_hw_primary: select_output_device: AUDIO_DEVICE_OUT_ALL
05-18 12:01:12.065 238 4760 I audio_hw_primary: in_reconfigure_channels: config_changed 0 effect 0x0
05-18 12:01:12.069 238 4760 D audio_hw_primary: select_input_device: AUDIO_DEVICE_IN_DEFAULT
Reading the code from
audio_hw.c, it seems to me that the functions
select_output_device and
select_input_device are selecting
AUDIO_DEVICE_OUT_ALL and
AUDIO_DEVICE_IN_DEFAULT respectively when they should be selecting
AUDIO_DEVICE_OUT_ALL_SCO and
AUDIO_DEVICE_IN_ALL_SCO.
I'll be posting updates as I move along. But please, if any dev can give me a hand it would be awesome, I'm a total noob on Android or anything besides knowing a little C++.
Just a little update, I spent the last week and a half setting up a build enviroment and debugging the damn thing. Android is totally a first for me. The bug is not solved yet, but I did fix another one and identified even one more:
- Debug messages from
select_output_device and
select_input_device turned out to be misleading but OK. Problem was the device being selected is defines as 0x20 (AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET) and it was not falling into the switch category for AUDIO_DEVICE_IN_ALL_SCO. This was no problem as it was simply giving out log messages, the device still is being correcly passed to
select_devices.
- The
select_devices function is where most of the problems were:
- In some point, function
do_input_standby was modified to select device 0x0 (AUDIO_DEVICE_NONE). This causes problems in
select_devices because some logic operations it performs where affected by the 0 value, causing it to select one or more wrong devices from the devices structs, making wrong and multiple audio routes.
- Another bug is that, for some reason, OUT and IN devices having the same integer indentifiers where being selected at the same time. For example
AUDIO_DEVICE_OUT_WIRED_HEADSET with identifier 0x4 was being selected in conjunction with it´s input cousin
AUDIO_DEVICE_IN_BUILTIN_MIC, also 0x4 (but with the input bit turned on).
--------------------------------------------
After solving these issues (sorta, not finished yet), I managed to get the code to finally select the SCO-OUT and SCO-IN routes defined in the XML files for TinyHAL. Unfortunately, this didn't solve the issue as I can´t still hear or transmit anything in SCO mode.
I'm currently checking the routes being used, wich requires me to read and understand how the WM1811 chip works and how it routes digital audio through it´s interfaces, that will take me a while. Any help will as always be appreciated.
No errors from the CODEC driver are being recorded in the kernel log buffer.
Will keep you updated.