我知道 Ubuntu (PulseAudio) 在蓝牙耳机方面存在众所周知的问题,有一段时间我一直在努力解决这个问题。经过多次尝试这个对我有帮助,一切似乎都正常。我甚至设法让自动切换配置文件在使用麦克风时正常工作。
但我使用两个 Ubuntu 系统(18.04 和 20.04),两个系统上相同耳机的可用编解码器不同。尽管我检查了所有配置、已安装的软件包、日志等,但一切看起来都完全一样。
在 20.04 我有加气混凝土编解码器默认情况下和微流控芯片当使用麦克风这很好。但在 18.04 上,我有新加坡基督教学院编解码器默认情况下和心血管疾病当使用麦克风这更糟糕。
18.04 上所有可用的配置文件:
- 耳机主机(HSP/HPF、编解码器 CVSD)
- 高保真播放(A2DP 接收器)
- 高保真播放(A2DP 接收器、编解码器 SBC)
20.04 上所有可用的配置文件:
- 耳机主机(HSP/HPF、编解码器 mSBC)
- 高保真播放(A2DP 接收器)
- 高保真播放(A2DP 接收器、编解码器 SBC-XQ)
- 高保真播放(A2DP 接收器、编解码器 SBC)
- 高保真播放(A2DP 接收器、编解码器 AAC)
如何将相同的编解码器带到 18.04 以提高质量?
/etc/pipewire/media-session.d/bluez-monitor.conf(两个系统相同,几乎是默认的,但是bluez5.autoswitch-配置文件设置为 true ):
# Bluez monitor config file for PipeWire version 0.4.1 #
#
# Copy and edit this file in /etc/pipewire/media-session.d/
# for system-wide changes or in
# ~/.config/pipewire/media-session.d/ for local changes.
properties = {
# These features do not work on all headsets, so they are enabled
# by default based on the hardware database. They can also be
# forced on/off for all devices by the following options:
#bluez5.enable-sbc-xq = true
#bluez5.enable-msbc = true
#bluez5.enable-hw-volume = true
#bluez5.enable-faststream = true
# See bluez-hardware.conf for the hardware database.
# Enabled headset roles (default: [ hsp_hs hfp_ag ]), this
# property only applies to native backend. Currently some headsets
# (Sony WH-1000XM3) are not working with both hsp_ag and hfp_ag
# enabled, disable either hsp_ag or hfp_ag to work around it.
#
# Supported headset roles: hsp_hs (HSP Headset),
# hsp_ag (HSP Audio Gateway),
# hfp_hf (HFP Hands-Free),
# hfp_ag (HFP Audio Gateway)
#bluez5.headset-roles = [ hsp_hs hsp_ag hfp_hf hfp_ag ]
# Enabled A2DP codecs (default: all).
#bluez5.codecs = [ sbc sbc_xq aac ldac aptx aptx_hd aptx_ll aptx_ll_duplex faststream faststream_duplex ]
# HFP/HSP backend (default: native).
# Available values: any, none, hsphfpd, ofono, native
#bluez5.hfphsp-backend = native
# Properties for the A2DP codec configuration
#bluez5.default.rate = 48000
#bluez5.default.channels = 2
# Register dummy AVRCP player, required for AVRCP volume function.
# Disable if you are running mpris-proxy or equivalent.
#bluez5.dummy-avrcp-player = true
}
rules = [
# An array of matches/actions to evaluate.
{
# Rules for matching a device or node. It is an array of
# properties that all need to match the regexp. If any of the
# matches work, the actions are executed for the object.
matches = [
{
# This matches all cards.
device.name = "~bluez_card.*"
}
]
actions = {
# Actions can update properties on the matched object.
update-props = {
# Auto-connect device profiles on start up or when only partial
# profiles have connected. Disabled by default if the property
# is not specified.
#bluez5.auto-connect = [
# hfp_hf
# hsp_hs
# a2dp_sink
# hfp_ag
# hsp_ag
# a2dp_source
#]
bluez5.auto-connect = [ hfp_hf hsp_hs a2dp_sink ]
# Hardware volume control (default: all)
#bluez5.hw-volume = [
# hfp_hf
# hsp_hs
# a2dp_sink
# hfp_ag
# hsp_ag
# a2dp_source
#]
# LDAC encoding quality
# Available values: auto (Adaptive Bitrate, default)
# hq (High Quality, 990/909kbps)
# sq (Standard Quality, 660/606kbps)
# mq (Mobile use Quality, 330/303kbps)
#bluez5.a2dp.ldac.quality = auto
# AAC variable bitrate mode
# Available values: 0 (cbr, default), 1-5 (quality level)
#bluez5.a2dp.aac.bitratemode = 0
# Profile connected first
# Available values: a2dp-sink (default), headset-head-unit
#bluez5.profile = a2dp-sink
# A2DP <-> HFP profile auto-switching (when device is default output)
# Available values: false, role (default), true
# 'role' will switch the profile if the recording application
# specifies Communication (or "phone" in PA) as the stream role.
bluez5.autoswitch-profile = true
}
}
}
{
matches = [
{
# Matches all sources.
node.name = "~bluez_input.*"
}
{
# Matches all sinks.
node.name = "~bluez_output.*"
}
]
actions = {
update-props = {
#node.nick = "My Node"
#node.nick = null
#priority.driver = 100
#priority.session = 100
node.pause-on-idle = false
#resample.quality = 4
#channelmix.normalize = false
#channelmix.mix-lfe = false
#session.suspend-timeout-seconds = 5 # 0 disables suspend
#monitor.channel-volumes = false
# A2DP source role, "input" or "playback"
# Defaults to "playback", playing stream to speakers
# Set to "input" to use as an input for apps
#bluez5.a2dp-source-role = input
}
}
}
]
更新。看起来原因是 bluez 版本。Ubuntu 20.04 有 bluez5.53,而 Ubuntu 18.04 最新版本是 bluez5.48。我尝试寻找 PPA,只找到一个(ppa:bluetooth/bluez)提供 5.50 版本。但不幸的是,它什么都没有改变。有什么好方法可以将 Ubuntu 18.04 中的 bluez 版本升级到最新版本?只能手动编译吗?