Android 设备作为 A2DP 配置文件的接收器 [英] Android device as a receiver for A2DP profile

查看:59
本文介绍了Android 设备作为 A2DP 配置文件的接收器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我现在想要做的是使用安卓设备作为 A2DP 接收器,当配对建立时,安卓播放从发射器接收到的声音.我担心如果我使用 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

/external/bluetooth/bluedroid/包括/bt_target.h.这会在蓝牙堆栈中启用接收器支持.

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

您还必须进行此更改:

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

/packages/apps/蓝牙/res/values/config.xml.这将启用特定的用户界面.

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

现在您可以配对您的设备并开始流式传输.不幸的是,尽管您会收到数据包,但您将听不到任何声音.原因是 A2DP sink 没有音频路由.在此补丁的提交消息中 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:

这篇关于Android 设备作为 A2DP 配置文件的接收器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆