I am using Bluetooth headset to play and record audio on my Dragonboard. I am able to play audio playback successfully but audio is not being recorded from the Bluetooth mic. Is there any settings which I need to do to control the audio input line?
For pulseaudio systems this will depend both on how old your pulseaudio is and on what application you are using to record audio.
Autoswitching between A2DP and HSP was not implemented until pulseaudio 10.0 and by default, the switch will only take place for if the recording stream sets media.role=phone (e.g. uses pulseaudio API). In PA 11 a new option appears to have been introduced to allow users of the wrapper APIs (such as ALSA) to also provoke swapping (see release notes for more details).
If you are running an older version of pulseaudio you probably need a hack similar to this one to swap between roles:
It seems it is python file and can be run linux. I am looking a solution which can work on Android. Would you please share any sample android project or settings guidelines.
Generally it is a good idea to say what OS you are running in the first post. I assumed you were not running Android because Android is supposed to switch automatically.
Unfortunately because Android is supposed to switch automatically I doubt you will find Android sample project or settings guidelines to help with this.
It might be worth checking that the app you are using for recording works correctly (via BT) on an Android phone but after that I’m afraid I can’t help much.
Which Android is another important question that hasn’t been answered. Is it Qualcomm’s ancient 5.1? Or AOSP master? If AOSP master, how recent?
I am using Qualcomm’s 5.1.1 version of Android. Can you help me set microphone working. As @danielt had pointed out that Android is supposed to auto switch it automatically but it is not doing. Is there any setting which I need to do.
Can I set Bluetooth Speaker and Microphone always default output and input?
“Supposed to” does not mean that it is fully or properly implemented. Qualcomm in particular, seems to really like to add tons of unnecessary complexity to their audio routing schemes. It makes it extremely difficult to make heads or tails of audio.
My suggestion would be to try with AOSP master instead of the ancient 5.1. It will have a much simpler audio routing scheme, that may just work without you having to do anything. HOWEVER, it may not, in which case it will still be a simpler job for you to sort out the audio routing policies of AOSP master than 5.1. Note of course, that the audio routing problem could also be at the kernel level.
Unlike A2DP, which in Android, is exclusively over HCI (bluetooth data link), HSP (and HFP) will deliver audio using dedicated audio hardware, which in most cases, will be via i2s. I think (its been a while since I’ve looked at it), that qualcomm has their own scheme, but still ultimately, the audio will come from an audio (alsa) device, rather than from HCI, which means that they will require mucking around with audio drivers and routing.