更新到 16.04 后,蓝牙音频 A2DP 模式停止工作

Rma*_*ano 30 sound pulseaudio bluetooth 16.04

我有一个很好的蓝牙音频接收器连接到我的 HiFi 立体声系统,我曾经能够在 14.04 中将它连接为质量很好的 A2DP 接收器。

升级到 16.04 后,该设备仅作为耳机连接,当尝试将其切换为 A2DP 模式时,我的系统日志中出现此错误:

May 21 11:35:50 RRyS pulseaudio[6159]: [pulseaudio] module-bluez5-device.c: Refused to switch profile to a2dp_sink: Not connected
Run Code Online (Sandbox Code Playgroud)

并且音频质量很差。我该如何解决?

小智 40

对我有用的是连接蓝牙设备,切换到 HSP/HFP 模式,断开连接,重新连接,然后切换到 A2DP 模式。

  • 同样在这里。但是,它不应该是这种方式,它曾经在以前的版本中正常工作。 (4认同)
  • 这太奇怪了,但它奏效了! (2认同)

Rma*_*ano 36

有几个关于此的错误,例如检查这个(从 15.05 开始)另一个,相当老;总体原因尚不清楚。

在开始修改系统文件之前,您还可以在 Ubuntu 16.04 中检查蓝牙扬声器没有声音(似乎是不同的错误)和A2DP 蓝牙在 16.04 上不起作用(通过内核升级在评论中解决)。

对我有用的修复如下 --- 感谢启动板中的用户 RobertFMArch 论坛中的 SimFox3。以下所有指令都必须从 root shell ( sudo -i) 执行。小心并三重检查。

  1. 首先,备份这些文件(你永远不知道):

    cp /etc/bluetooth/audio.conf /etc/bluetooth/audio.conf.bak
    cp /etc/pulse/default.pa /etc/pulse/default.pa.bak
    cp /usr/bin/start-pulseaudio-x11 /usr/bin/start-pulseaudio-x11.bak
    
    Run Code Online (Sandbox Code Playgroud)
  2. 编辑/etc/bluetooth/audio.conf并使其与此类似:

    # Configuration file for the audio service
    # This section contains options which are not specific to any
    # particular interface
    [General]
    Enable=Gateway,Source
    
    # Switch to master role for incoming connections (defaults to true)
    Master=true
    
    # If we want to disable support for specific services
    # Defaults to supporting all implemented services
    #Disable=Gateway,Source,Socket
    Disable=Socket
    
    # SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
    # Defaults to HCI
    #SCORouting=HCI
    
    # Automatically connect both A2DP and HFP/HSP profiles for incoming
    # connections. Some headsets that support both profiles will only connect the
    # other one automatically so the default setting of true is usually a good
    # idea.
    AutoConnect=true
    
    # Headset interface specific options (i.e. options which affect how the audio
    # service interacts with remote headset devices)
    [Headset]
    
    # Set to true to support HFP, false means only HSP is supported
    # Defaults to true
    HFP=true
    
    # Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
    MaxConnected=2
    
    # Set to true to enable use of fast connectable mode (faster page scanning)
    # for HFP when incoming call starts. Default settings are restored after
    # call is answered or rejected. Page scan interval is much shorter and page
    # scan type changed to interlaced. Such allows faster connection initiated
    # by a headset.
    FastConnectable=true
    
    # Just an example of potential config options for the other interfaces
    #[A2DP]
    #SBCSources=1
    #MPEG12Sources=0
    
    Run Code Online (Sandbox Code Playgroud)
  3. 编辑/etc/pulse/default.pa并注释掉该行

    #load-module module-bluetooth-discover
    
    Run Code Online (Sandbox Code Playgroud)

    (你真的只需要#在开始时添加)

  4. 加载模块后编辑/usr/bin/start-pulseaudio-x11并添加该行;在实践中,您应该在接近结尾处编辑文件以获得类似的节/usr/bin/pactl load-module module-bluetooth-discovermodule-x11-xsmp

    if [ x"$SESSION_MANAGER" != x ] ; then
        /usr/bin/pactl load-module module-x11-xsmp "display=$DISPLAY session_manager=$SESSION_MANAGER" > /dev/null
        # add this line here:
        /usr/bin/pactl load-module module-bluetooth-discover
    fi
    
    Run Code Online (Sandbox Code Playgroud)
  5. 重启。

    现在您应该能够将您的设备设置为 A2DP 并享受高质量的音乐:

    声音设置

    请注意,有时您需要断开并重新连接您的设备以重新启用 A2DP:

    蓝牙设备

    ...是的,这是一大堆错误。但是当它工作时,它工作得很好。

  6. 重启后的问题

    毕竟,有时这个技巧似乎只有在下一次重新启动后才起作用。在这种情况下,请尝试遵循rmfought 的回答

    对我有用的是连接蓝牙设备,切换到 HSP/HFP 模式,断开连接,重新连接,然后切换到 A2DP 模式。

    ...也适用于我(再次,有时)。我什至不得不取消配对重新配对加密狗一次。

  7. 如果还是不行...

    如果这对您也不起作用,您可以尝试使用 此脚本--- 它的作者正在使其保持最新状态。

  • audio.conf 在 ubuntu 16.04 中不存在,只有 main.conf,可以吗? (5认同)
  • @JoakimKoed --- 你是对的,我检查过 --- 我有一个 `audio.conf-remove` 可能是升级后的残余。我只是重新创建了它 --- 所以现在我怀疑,也许只有第 3 点和第 4 点是必要的? (2认同)

小智 5

对于需要麦克风的人来说,这不一定是解决方案,但这对我来说在 Ubuntu 16.04 中有效:

sudo nano /etc/bluetooth/audio.conf
Run Code Online (Sandbox Code Playgroud)

然后Disable=Headset[General].

[General]
Disable=Headset
Run Code Online (Sandbox Code Playgroud)

并重启蓝牙服务

sudo service bluetooth restart
Run Code Online (Sandbox Code Playgroud)

以及这个人的所有信用:https : //jimshaver.net/2015/03/31/going-a2dp-only-on-linux/