Android设备作为一个接收器支持A2DP接收器、作为一个、设备、Android

2023-09-13 23:54:45 作者:Dreams°終遇妳

基本上,我想现在做的是使用Android设备作为A2DP接收器和配对成立时,Android的播放声音是从发射机接收。我担心如果我使用STP的配置文件,它可能会导致流的延迟。所以,我想使用A2DP,但是这是可能使用Android设备的支持A2DP的接收器?怎么办呢?

Basically, what I am trying to do right now is use an android device as an A2DP receiver and when pairing established, android plays sound that is received from a transmitter. I am worrying that if I use STP profile, it may cause delay of streaming. So, I want to use A2DP but is this possible to use an android device as a receiver of A2DP? and how to do it?

推荐答案

由于Android L时BlueDriod堆栈不支持A2DP片,但它默认是禁用的。

Since Android L the BlueDriod stack does support A2DP sink, but it is disabled by default.

要启用它做到以下几点:

To enable it do the following:

/* Enable bluetooth av sink. */
#define BTA_AV_SINK_INCLUDED TRUE

在 /外部/蓝牙/ bluedroid /包括/ bt_target.h 。 这使得沉支持的蓝牙堆栈。

in /external/bluetooth/bluedroid/include/bt_target.h. This enables sink support in the bluetooth stack.

此外,你需要做的这种变化:

Also you have to do this change:

<!-- Enable sink support. -->
<bool name="profile_supported_a2dp_sink">true</bool>

在 /封装/应用程序/蓝牙/ RES /价值/ config.xml中。这使得特定的用户界面。

in /packages/apps/Bluetooth/res/values/config.xml. This enables the particular UI.

现在,你可以对你的设备,并开始流。不幸的是,你会听到任何声音,虽然你会收到的报文。其理由是,有支持A2DP水槽没有音频路由。在这个补丁的提交信息 https://android-review.googlesource.com/# / C / 98161 / 你可以找到关于如何解决此问题的示例实现。

Now you can pair your devices and start streaming. Unfortunately you will hear no sound although you'll receive the packets. The reason is that there is no audio route for A2DP sink. In the commit message of this patch https://android-review.googlesource.com/#/c/98161/ you can find a sample implementation on how to fix this.

下面是这些更改的列表:

Here is a list of these changes:

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 / 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/