简体   繁体   English

Pulseaudio为A2DP和HFP连接设置接收器和信号源

[英]Pulseaudio setting up sinks and sources for A2DP and HFP connections

I'm trying to set up A2DP+HFP profiles in an embedded board. 我正在尝试在嵌入式板上设置A2DP + HFP配置文件。 Goal is to use pulseaudio 12.2, ofono 1.18, and bluez 5.41 in order to connect to a mobile phone and use A2DP, HFP profiles automatically, whenever necessary. 目标是使用Pulseaudio 12.2,ofono 1.18和bluez 5.41,以便连接到手机并在需要时自动使用A2DP,HFP配置文件。 I did lots and lots of things to update the versions and configure the daemons. 我做了很多事情来更新版本和配置守护程序。 Right now I can see that HFP profile is available when connected. 现在,我可以看到连接时HFP配置文件可用。

A2DP works perfectly and I am able to stream music from phone to embedded board. A2DP完美运行,我能够将音乐从手机流式传输到嵌入式板。 When I get a call, I can answer it with Bluetooth and it looks that HFP is the active profile whilst I'm in the call. 接到电话后,可以通过蓝牙接听电话,并且在通话过程中,HFP似乎处于活动状态。 The weird thing is that there is no audio from the embedded board (HDMI monitor connected to it). 奇怪的是,嵌入式板(连接了HDMI监视器)没有音频。

The following will give you how it looks like. 以下内容将为您提供外观。 When I'm streaming music from phone via A2DP, I get following sources and sinks: 当我通过A2DP从电话流式传输音乐时,会收到以下来源和接收器:

pactl list short sinks
0   alsa_output.hw_1_0  module-alsa-sink.c  s16le 2ch 48000Hz   SUSPENDED
1   alsa_output.platform-sound.analog-mono  module-alsa-card.c  s16le 1ch 48000Hz   SUSPENDED
2   alsa_output.platform-sound-hdmi.stereo-fallback module-alsa-card.c  s16le 2ch 48000Hz   RUNNING

pactl list short sources
0   alsa_output.hw_1_0.monitor  module-alsa-sink.c  s16le 2ch 48000Hz   SUSPENDED
1   alsa_output.platform-sound.analog-mono.monitor  module-alsa-card.c  s16le 1ch 48000Hz   SUSPENDED
2   alsa_input.platform-sound.analog-mono   module-alsa-card.c  s16le 1ch 48000Hz   SUSPENDED
3   alsa_output.platform-sound-hdmi.stereo-fallback.monitor module-alsa-card.c  s16le 2ch 48000Hz   IDLE
5   bluez_source.D8_5B_2A_5B_7B_E6.a2dp_source  module-bluez5-device.c  s16le 2ch 44100Hz   RUNNING

Whenever I'm in the call (using HFP), I get following sources and sinks: 每当我通话时(使用HFP),我都会收到以下消息来源和接收者:

pactl list short sources
0   alsa_output.hw_1_0.monitor  module-alsa-sink.c  s16le 2ch 48000Hz   SUSPENDED
1   alsa_output.platform-sound.analog-mono.monitor  module-alsa-card.c  s16le 1ch 48000Hz   SUSPENDED
2   alsa_input.platform-sound.analog-mono   module-alsa-card.c  s16le 1ch 48000Hz   SUSPENDED
3   alsa_output.platform-sound-hdmi.stereo-fallback.monitor module-alsa-card.c  s16le 2ch 48000Hz   SUSPENDED
7   bluez_sink.D8_5B_2A_5B_7B_E6.headset_audio_gateway.monitor  module-bluez5-device.c  s16le 1ch 8000Hz    IDLE
8   bluez_source.D8_5B_2A_5B_7B_E6.headset_audio_gateway    module-bluez5-device.c  s16le 1ch 8000Hz    RUNNING

pactl list short sinks  
0   alsa_output.hw_1_0  module-alsa-sink.c  s16le 2ch 48000Hz   SUSPENDED
1   alsa_output.platform-sound.analog-mono  module-alsa-card.c  s16le 1ch 48000Hz   SUSPENDED
2   alsa_output.platform-sound-hdmi.stereo-fallback module-alsa-card.c  s16le 2ch 48000Hz   SUSPENDED
3   bluez_sink.D8_5B_2A_5B_7B_E6.headset_audio_gateway  module-bluez5-device.c  s16le 1ch 8000Hz    RUNNING

This is quite weird since sink changes from my HDMI monitor to the bluetooth device itself whenever I am in the call. 这很奇怪,因为只要我在通话中,接收器就会从我的HDMI监视器变为蓝牙设备本身。 Please find my /etc/pulse/default.pa below: 请在下面找到我的/etc/pulse/default.pa

.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties

### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
load-module module-alsa-sink device=hw:1,0
#load-module module-alsa-source 
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy ag=true auto_switch=2
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover headset=auto
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix auth-anonymous=1

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish

### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor


### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif

### Enable positioned event sounds
load-module module-position-event-sounds

### Cork music/video streams when a phone stream is active
load-module module-role-cork

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

load-module module-switch-on-connect

### Make some devices default
# Make HDMI default
set-default-sink 0
#set-default-source input

The following is my .asoundrc ALSA configuration (HDMI device by default): 以下是我的.asoundrc ALSA配置(默认情况下为HDMI设备):

pcm.!default {
    type hw
    card 1
    device 0
}

Any help is greately appreciated. 非常感谢任何帮助。 Thanks in advance. 提前致谢。

Try (before connecting call) 试试(在接通电话之前)

pactl set-default-sink alsa_output.platform-sound-hdmi.stereo-fallback
pactl set-default-source alsa_output.platform-sound.analog-mono.monitor

If issue is not solved yet, Please share what you get from 如果问题仍未解决,请分享您从中获得的收益

pacmd list-sinks
pacmd list-sources
pacmd list-sink-inputs
pacmd list-source-outputs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM