-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure: Module initialization failed #337
Comments
Hi @tyzbit Please can you try running pulseaudio with the --verbose flag set, hopefully the output will then give some clue as to why the alsa-sink module initialization is failing. |
Here's what pulseaudio says in the logs:
And more logs:
When I try hfp or hfp-ag, I get a different error
When I compiled, I used these options
|
The above tells me that the a2dp profile is not connected for your headphones
That is because bluealsa accepts only a2dp or sco as values for the To keep things simple until you get the basics working, I recommend you start bluealsa as:
That will ensure that only hfp profile can be used, and prevent any issues with a2dp confusing things for now. Then try loading the pulseaudio alsa-sink module with:
Please report back with the result, and any error from pulseaudio if it fails. Once that is working, we can try adding a2dp if required. |
I might be one of the few people that wants HFP since I'm trying to use my headset as a communications device. Here's the output of trying to load the pulseaudio alsa-sink module:
Rerunning the DBus command, I see the headset present. |
that suggests the headset is not connected (at least not for hfp), but bluez (via dbus) says that it is. Maybe its actually the I think we need to make sure that bluealsa is configured correctly, and is working, before trying to use it through pulseaudio. |
/usr/share/alsa/alsa.conf.d/21-bluealsa-raw.conf
|
I was able to make some progress. If I run bluealsa with no profiles specified, this command now works (I have to use
I was able to narrow it down: if I set |
I have made even more progress - I added my user to the |
I was able to get the device working like this:
I do notice that after a dozen seconds or more, the audio stream gets choppy. This happens in all applications but is very noticeable in Discord. Should I open up a new issue? |
Do you get the "choppy" playback when using If so, then pulseaudio will only make things worse. If the above works correctly, then try different values for the fragment_size pulseaudio module parameter. For use with hfp, try a low value such as 80, then increase it until you find the best compromise between cpu load and audio stability. a fragment size of 80 for hfp works out at 5ms of audio, which is the value which has worked best for me. |
Using |
Doing some more testing, I found different applications trigger the choppy playback differently. Discord triggers it earliest and it's the worst, but playing audio through Firefox allows me to go minutes without an issue and when the issue does occur, it's less severe. To explain, when the audio gets choppy: DiscordAudio will pause, then play back for 30-80ms, then pause again for longer, then play the next 30-80ms, then pause for even longer, then usually skip a few seconds and play a semi-recent slice of 30-80ms. During this time, although my system's CPU is fine, it becomes less responsive and stutters FirefoxAudio will briefly stutter for 10ms or so, then play again for 3-5 seconds, then another brief stutter for 10ms. I've gotten over 3 minutes without any issues on Firefox with an fragment_size of 90. I did notice the following in my syslog: Expand
|
Doing some more testing, I found different applications trigger the choppy playback differently. Discord triggers it earliest and it's the worst, but playing audio through Firefox allows me to go minutes without an issue and when the issue does occur, it's less severe. To explain, when the audio gets choppy: DiscordAudio will pause, then play back for 30-80ms, then pause again for longer, then play the next 30-80ms, then pause for even longer, then usually skip a few seconds and play a semi-recent slice of 30-80ms. During this time, although my system's CPU is fine, it becomes less responsive and stutters FirefoxAudio will briefly stutter for 10ms or so, then play again for 3-5 seconds, then another brief stutter for 10ms. I've gotten over 3 minutes without any issues on Firefox with an fragment_size of 90. I did notice the following in my syslog: Expand
When it happens via Discord, this gets logged in syslog: ExpandMay 27 20:38:25 sen discord.desktop[19709]: [022:440] [19818] (audio_device_pulse_linux.cc:1855): Can't query latency May 27 20:38:25 sen discord.desktop[19709]: [022:510] [19818] (audio_device_pulse_linux.cc:1855): Can't query latency May 27 20:38:25 sen discord.desktop[19709]: message repeated 2 times: [ [022:510] [19818] (audio_device_pulse_linux.cc:1855): Can't query latency] May 27 20:38:25 sen discord.desktop[19709]: [022:510] [19814] (audio_send_stream.cc:285): Failed to set up send codec state. May 27 20:38:25 sen discord.desktop[19709]: [022:512] [19818] (audio_device_pulse_linux.cc:1855): Can't query latency May 27 20:38:25 sen discord.desktop[19709]: message repeated 3 times: [ [022:512] [19818] (audio_device_pulse_linux.cc:1855): Can't query latency] May 27 20:38:26 sen discord.desktop[19709]: [023:000] [19818] (audio_device_pulse_linux.cc:1855): Can't query latency |
PulseAudio doesn't appear to log any messages when the issue starts, but it does log messages when Discord tries to use the device: ExpandI: [pulseaudio] client.c: Created 98 "Native client (UNIX socket client)" I: [pulseaudio] protocol-native.c: Got credentials: uid=1001 gid=1001 success=1 I: [pulseaudio] client.c: Created 99 "Native client (UNIX socket client)" I: [pulseaudio] protocol-native.c: Got credentials: uid=1001 gid=1001 success=1 I: [pulseaudio] client.c: Created 100 "Native client (UNIX socket client)" I: [pulseaudio] protocol-native.c: Got credentials: uid=1001 gid=1001 success=1 I: [pulseaudio] module-stream-restore.c: Restoring device for stream sink-input-by-application-name:Chromium. I: [pulseaudio] sink-input.c: Trying to change sample rate I: [pulseaudio] sink.c: Cannot update rate, SINK_IS_RUNNING, will keep using 8000 Hz I: [pulseaudio] module-stream-restore.c: Restoring mute state for sink input sink-input-by-application-name:Chromium. I: [pulseaudio] remap.c: Using stereo to mono remapping I: [pulseaudio] speex.c: Choosing speex quality setting 1. I: [pulseaudio] sink-input.c: Created input 38 "Playback" on btheadset with sample spec float32le 2ch 44100Hz and channel map front-left,front-right I: [pulseaudio] sink-input.c: application.icon_name = "chromium-browser" I: [pulseaudio] sink-input.c: media.name = "Playback" I: [pulseaudio] sink-input.c: application.name = "Chromium" I: [pulseaudio] sink-input.c: native-protocol.peer = "UNIX socket client" I: [pulseaudio] sink-input.c: native-protocol.version = "32" I: [pulseaudio] sink-input.c: application.process.id = "7139" I: [pulseaudio] sink-input.c: application.process.user = "tyzbit" I: [pulseaudio] sink-input.c: application.process.host = "sen" I: [pulseaudio] sink-input.c: application.process.binary = "Discord" I: [pulseaudio] sink-input.c: application.language = "en_US.UTF-8" I: [pulseaudio] sink-input.c: window.x11.display = ":0" I: [pulseaudio] sink-input.c: application.process.machine_id = "92ac2dd12f9045f3961d5c0df7002221" I: [pulseaudio] sink-input.c: application.process.session_id = "3" I: [pulseaudio] sink-input.c: module-stream-restore.id = "sink-input-by-application-name:Chromium" I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Final latency 414.96 ms = 200.00 ms + 2*7.48 ms + 200.00 ms I: [pulseaudio] module-stream-restore.c: Restoring mute state for source output source-output-by-application-name:WEBRTC VoiceEngine. I: [pulseaudio] source-output.c: Created output 34 "recStream" on alsa_input.pci-0000_00_1f.3.analog-stereo with sample spec s16le 2ch 44100Hz and channel map front-left,front-right I: [pulseaudio] source-output.c: media.name = "recStream" I: [pulseaudio] source-output.c: application.name = "WEBRTC VoiceEngine" I: [pulseaudio] source-output.c: native-protocol.peer = "UNIX socket client" I: [pulseaudio] source-output.c: native-protocol.version = "32" I: [pulseaudio] source-output.c: application.process.id = "7107" I: [pulseaudio] source-output.c: application.process.user = "tyzbit" I: [pulseaudio] source-output.c: application.process.host = "sen" I: [pulseaudio] source-output.c: application.process.binary = "Discord" I: [pulseaudio] source-output.c: application.language = "en_US.UTF-8" I: [pulseaudio] source-output.c: window.x11.display = ":0" I: [pulseaudio] source-output.c: application.process.machine_id = "92ac2dd12f9045f3961d5c0df7002221" I: [pulseaudio] source-output.c: application.process.session_id = "3" I: [pulseaudio] source-output.c: module-stream-restore.id = "source-output-by-application-name:WEBRTC VoiceEngine" I: [pulseaudio] protocol-native.c: Final latency 60.00 ms = 30.00 ms + 30.00 ms I: [pulseaudio] sink-input.c: Trying to change sample rate I: [pulseaudio] sink.c: Cannot update rate, SINK_IS_RUNNING, will keep using 8000 Hz I: [pulseaudio] module-stream-restore.c: Restoring mute state for sink input sink-input-by-application-name:WEBRTC VoiceEngine. I: [pulseaudio] speex.c: Choosing speex quality setting 1. I: [pulseaudio] sink-input.c: Created input 39 "playStream" on btheadset with sample spec s16le 1ch 44100Hz and channel map mono I: [pulseaudio] sink-input.c: media.name = "playStream" I: [pulseaudio] sink-input.c: application.name = "WEBRTC VoiceEngine" I: [pulseaudio] sink-input.c: native-protocol.peer = "UNIX socket client" I: [pulseaudio] sink-input.c: native-protocol.version = "32" I: [pulseaudio] sink-input.c: application.process.id = "7107" I: [pulseaudio] sink-input.c: application.process.user = "tyzbit" I: [pulseaudio] sink-input.c: application.process.host = "sen" I: [pulseaudio] sink-input.c: application.process.binary = "Discord" I: [pulseaudio] sink-input.c: application.language = "en_US.UTF-8" I: [pulseaudio] sink-input.c: window.x11.display = ":0" I: [pulseaudio] sink-input.c: application.process.machine_id = "92ac2dd12f9045f3961d5c0df7002221" I: [pulseaudio] sink-input.c: application.process.session_id = "3" I: [pulseaudio] sink-input.c: module-stream-restore.id = "sink-input-by-application-name:WEBRTC VoiceEngine" I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Final latency 414.96 ms = 200.00 ms + 2*7.48 ms + 200.00 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] sink-input.c: Freeing input 38 "Playback" I: [pulseaudio] client.c: Freed 100 "Chromium" I: [pulseaudio] protocol-native.c: Connection died. I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] protocol-native.c: Requested tlength=30.00 ms, minreq=7.48 ms I: [pulseaudio] sink-input.c: Freeing input 39 "playStream" |
Unfortunately, I don't have free time to work on this atm, but will look at it again when I can. I would suggest that you try simpler applications first, before Discord etc, just to discover if the basics are working. Pulseaudio clients use one of two methods to interface with the pulse daemon: most modern Linux desktop applications use pulse's own native API, whereas many others use the alsa API through alsa's pulse plugin. The simplest available application for the pulse API is paplay, which is in the pulseaudio-utils package and included by default in Ubuntu desktop. The simplest alsa application is of course aplay. To test the pulseaudio API, try:
And to test the alsa API, first make sure the headset is selected as the default sink in pulse, then try:
If you cannot solve the choppy playback with either of these, then please post the outputs here and I will eventually try to understand where the issue is. |
Great, thank you for your help so far, it has been tremendously helpful and I feel as though I'm extremely close to getting it working. As a troubleshooting step I upgraded from 18.04 to 20.04, which has changed things a bit. I will take some time to continue investigating including using |
I'm unable to get my system back to the state it was in to continue troubleshooting, so I'm closing this issue. |
This is almost a duplicate of #312 as I have the same symptoms and behavior, but trying to load the module fails for me instead of succeeds:
I've tried the a2dp profile, the sco profile and the hfp-ag profile (the one I actually want to use)
I see my device in DBus
I'm on commit 49ad348, and I'm running bluealsa manually specifying profiles.
I don't have the pulseaudio bluetooth module even installed.
The text was updated successfully, but these errors were encountered: