BlueZ vs Bluedroid bluetooth stack

30.1k views Asked by At

BlueZ have a lot of documentations and all. And from the same, i understood BlueZ supports A2DP sink support. And at the same time an android device can be made act as an A2DP sink by modifying the audio.conf file inside the same.

I also came to know that from android 4.2 onwards, the BlueZ stack was replaced by Broadcom's Bluedroid stack. I searched a lot about Bluedroid stack. But i was not able to find much details about the same.

Hope someone can help me with the following doubts.

1). Whether Bluedroid have A2DP sink support?

2). Whether the audio.conf file will be available for devices having bluedroid stack?

3). I am going to write an A2DP sink support for an android device by directly calling API's of BlueZ stack. But my final question is whether the same can be used with Bluedroid stack also? Hope Bluedroid is just an expansion of BlueZ.

Please help.

4

There are 4 answers

7
ashish On BEST ANSWER

Bluedroid is a stack provided by Broadcom and is now opensource in android . Bluedroid is not related with bluez in any respect, it has few advantages over bluez(i differ to that).

[1]. Bluedroid does not have a2dp sink support as of now, as per code available source code only a2dp source support is available

[2]. Audio.conf file is for bluez stack, it is not a part of bluedroid

[3]. Directly calling Bluez API-- i think you will use dbus calls but bluedroid does not support dbus method calls, it has a callback mechanism implemented, so it will not work, bluedroid is not an expansion of bluez.

1
theangrylama On

A2DP Sink role is now supported in Android Lollipop (5.0). They have modified the Bluedroid source code to support the same. To completely support it , you need to modify the audio HAL (audio.h), AudioPolicyManagerBase.cpp and audio_policy.conf and Also Audio Manager, A2DPStateMachine etc.

1
Boatman_Yang On

As user987500 said, A2DP sink is supported in android L,only make minor modification, you device can changed from A2DP src to sink. But be sure only one role can be supported for one device, which can be configured from xml file.

1
aksonlyaks On

Adding to the above answers, since Android L, sink support is introduced but still Audio streaming portion of code is not completed. However, I have found this change list where a2dp sink implementation is completed and media can be played through sink device as mentioned in the commit message of the change list:

Bluetooth A2DP Sink

The change implements the A2DP sink feature. If the android device is a sink role, it can receive music from phone via BT. This feature can be apply in multimedia car kit, set-top box and family HiFi. Set BLUETOOTH_A2DP_SINK := true in BoardConfig.mk to enable A2DP Sink featue in bluedroid.

You also need the changes below in framework to route music to speaker. https://android-review.googlesource.com/#/c/97832/ https://android-review.googlesource.com/#/c/97853/ https://android-review.googlesource.com/#/c/97833/ https://android-review.googlesource.com/#/c/98130/ https://android-review.googlesource.com/#/c/98131/

This change does not include SBC decoder. You can get a SBC decoder from github.com/tieto/sbc-decoder.

All the best!!!