Ticket #641 (reopened defect)

Opened 2 years ago

Last modified 13 months ago

Pulseaudio crashes when switching Bluetooth headset from "Telephony" to "High Fidelity" (A2DP)

Reported by: foxmajik Owned by: lennart
Milestone: Component: daemon
Keywords: bluetooth, module-bluetooth-discover, blueman, a2dp Cc: ajvok1@…

Description

Since upgrading to pulseaudio 0.9.15, A2DP no longer works.

When attempting to switch the output to A2DP using the pulseaudio volume control application, pulseaudio crashes with this output:

E: sink.c: Assertion 'pa_frame_aligned(length, &s->sample_spec)' failed at pulsecore/sink.c:939, function pa_sink_render_full(). Aborting.

[2]+ Aborted pulseaudio

---

Steps to reproduce:

1. Load pulseaudio

$ pulseaudio&

2. Load Bluetooth discover module

$ pactl load-module module-bluetooth-discover 15

3. Pair the device using blueman-manager

4. Right-click the device in blueman-manager and click "Connect to A2DP Service"

At this point the device shows up as "MOTOROLA S805" in the Pulseaudio Manager application.

5. Open up Audacious and play some audio.

The audio plays using the "telephony device," which is mono and telephone quality.

So of course the next thing I would want to do is open up the volume application and set the output to the High Fidelity (A2DP) setting.

But when I do this, Pulseaudio crashes. See the error above and the screen shot attached.

Note I did not select module-bluetooth-discover because the option is not available on the "component" menu.

Attachments

Screenshot.png (113.7 kB) - added by foxmajik 2 years ago.
Screen shot demonstrating pulseaudio crashing when the device is set to A2DP.
pa-bluetooth-channels.patch (1.5 kB) - added by samr7 19 months ago.
Potential fix

Change History

Changed 2 years ago by foxmajik

Screen shot demonstrating pulseaudio crashing when the device is set to A2DP.

  Changed 2 years ago by lennart

First, please run PA via "pulseaudio -D".

Second, module-bluetooth-discover is loaded anywy way by default. No need to run it manually.

Third, what's that suffix '15' supposed to mean?

Fourth, please use a recent version of gnome-bluetooth, that's what is supported from upstream

Fifth, I have no idea what you mean by "component" menu.

Sixth, and most importantly: please provide a proper backtrace, as described here: http://pulseaudio.org/wiki/Community#BugsPatchesTranslations

follow-up: ↓ 3   Changed 2 years ago by foxmajik

First, please run PA via "pulseaudio -D".

Thanks, you should put in some useful feedback to the user such that when they run the program without that switch it should inform them that might be a better way to do it.

Second, module-bluetooth-discover is loaded anywy way by default. No need to run it manually.

Before loading the module it does not display in the Manager application provided with the distribution. After loading the module, it does. After loading the module, upon running the same command to load the module a second time, I am informed that the module is already loaded. Therefore, either the module is not loaded by default or the output of the Manager application is misleading.

Third, what's that suffix '15' supposed to mean?

That is the output produced when you type that command.

Fourth, please use a recent version of gnome-bluetooth, that's what is supported from upstream

I'm using the version from gnome-bluetooth's launchpad site, which is the latest available version.

Fifth, I have no idea what you mean by "component" menu.

At the bottom of form I typed the bug report into there is a "component" menu where I am supposed to choose which component of the software the bug report pertains to, however the components listed were not sufficient to cover the issue I was reporting.

Sixth, and most importantly: please provide a proper backtrace, as described here: http://pulseaudio.org/wiki/Community#BugsPatchesTranslations

I'll get that for you after work. Also, your tone is negative. I feel like I'm being talked down to when in fact I'm trying to help you improve this project by providing useful user feedback. This process will probably be more productive if you could use a less demeaning manner of speech.

in reply to: ↑ 2   Changed 2 years ago by lennart

Replying to foxmajik:

First, please run PA via "pulseaudio -D".

Thanks, you should put in some useful feedback to the user such that when they run the program without that switch it should inform them that might be a better way to do it.

There are cases where running PA without -D does make sense. But certainly not if you run it with a & suffix in the shell anyway. And there is no way to figure out if PA was started with & from the shell or not. So I see no way how we could print a message like that.

Also, a distribution should run PA automatically via an xdg autostart file, which is what we do upstream. There should not be the need to run it manually at all.

Second, module-bluetooth-discover is loaded anywy way by default. No need to run it manually.

Before loading the module it does not display in the Manager application provided with the distribution. After loading the module, it does. After loading the module, upon running the same command to load the module a second time, I am informed that the module is already loaded. Therefore, either the module is not loaded by default or the output of the Manager application is misleading.

Which distribution is this? The upstream version of PA certainly does enable this module by default.

I'm using the version from gnome-bluetooth's launchpad site, which is the latest available version.

What you wrote above suggested you where using something called "blueman-manager".

  Changed 2 years ago by foxmajik

And there is no way to figure out if PA was started with & from the shell or not. So I see no way how we could print a message like that.

Also, a distribution should run PA automatically via an xdg autostart file, which is what we do upstream. There should not be the need to run it manually at all.

PA is automatigically started during login but it crashes when I attempt to use A2DP functionality. This creates the need to run it manually. Restarting my operating system or even my window manager during the process of troubleshooting is not practical.

What you wrote above suggested you where using something called "blueman-manager".

Blueman-manager is a GTK frontend to gnome-bluetooth. I apologize for the confusion.

The version of gnome-bluetooth I have may not be the latest -- I am using the version provided by Canonical for version 9.04 of Ubuntu in the default OS repository.

However, the problem I am experiencing is not with finding or pairing the device. Nor is the problem related to the loading of modules nor to the GTK frontend application I use for managing bluetooth devices. I have all of those sorted on my own by reading documentation and the experiences of other users.

The problem is that the output goes to the telephony function of the bluetooth device rather than the high-fidelity A2DP function by default. When I attempt to switch to high fidelity output using the PA Manager application provided with PA, PA crashes.

I am using the version of PA provided on the PA launchpad as of the time this bug report was written, not the version that comes with my OS distribution. I installed this version by adding the Launchpad debs to my sources.list and forcing an upgrade.

  Changed 2 years ago by lennart

Hmm, any chance you can get me a proper backtrace?

  Changed 2 years ago by foxmajik

  • status changed from new to closed
  • resolution set to worksforme

Hmm, it seems the problem was with something other than pulseaudio.

After recent upgrades to these packages pulseaudio no longer crashes when I switch to A2DP:

bluetooth (1:4.39-0ubuntu2)

bluez-alsa (1:4.39-0ubuntu2)

bluez-cups (1:4.39-0ubuntu2)

bluez-gstreamer (1:4.39-0ubuntu2)

bluez-utils (1:4.39-0ubuntu2)

However it's still a little inconvenient that A2DP is not selected by default.

It's still a little kludgey.

I have to:

1. Pair the headset.
2. Tell Bluetooth to connect to the A2DP service.
3. Stop playing audio and start it again in my application.
4. Tell Pulseaudio Volume Control to switch my application from my Intel onboard codec to the A2DP output on my headset (on the Configuration tab).
5. Switch to the Playback tab and turn up the volume switch for the application playing audio (because it defaults to 0 for some reason, possibly the application's fault [I am using Audacious]).

An option to have A2DP be the default output to my bluetooth headset would be useful.

I can move streams between bluetooth and my Intel onboard audio codec without Pulseaudio crashing, which is very nice.

I'm not sure if it'll be helpful but here's the output from the upgrade.


(Reading database ... 187116 files and directories currently installed.)
Preparing to replace libbluetooth3 4.53-0ubuntu2 (using .../libbluetooth3_1%3a4.39-0ubuntu2_amd64.deb) ...
Unpacking replacement libbluetooth3 ...
Preparing to replace bluez 4.53-0ubuntu2 (using .../bluez_1%3a4.39-0ubuntu2_amd64.deb) ...
 * Stopping bluetooth
   ...done.
Unpacking replacement bluez ...
Preparing to replace bluetooth 4.53-0ubuntu2 (using .../bluetooth_1%3a4.39-0ubuntu2_all.deb) ...
Unpacking replacement bluetooth ...
Preparing to replace bluez-alsa 4.53-0ubuntu2 (using .../bluez-alsa_1%3a4.39-0ubuntu2_amd64.deb) ...
Unpacking replacement bluez-alsa ...
Preparing to replace bluez-cups 4.53-0ubuntu2 (using .../bluez-cups_1%3a4.39-0ubuntu2_amd64.deb) ...
Unpacking replacement bluez-cups ...
Preparing to replace bluez-gstreamer 4.53-0ubuntu2 (using .../bluez-gstreamer_1%3a4.39-0ubuntu2_amd64.deb) ...
Unpacking replacement bluez-gstreamer ...
Preparing to replace bluez-utils 4.53-0ubuntu2 (using .../bluez-utils_1%3a4.39-0ubuntu2_all.deb) ...
Unpacking replacement bluez-utils ...
Processing triggers for man-db ...
Setting up libbluetooth3 (1:4.39-0ubuntu2) ...

Setting up bluez (1:4.39-0ubuntu2) ...
Installing new version of config file /etc/bluetooth/main.conf ...
Installing new version of config file /etc/dbus-1/system.d/bluetooth.conf ...
 * Reloading system message bus config...
   ...done.
 * Reloading kernel event manager...
   ...done.
 * Starting bluetooth
   ...done.

Setting up bluetooth (1:4.39-0ubuntu2) ...
Setting up bluez-alsa (1:4.39-0ubuntu2) ...
Setting up bluez-cups (1:4.39-0ubuntu2) ...
Setting up bluez-gstreamer (1:4.39-0ubuntu2) ...
Setting up bluez-utils (1:4.39-0ubuntu2) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place

  Changed 2 years ago by ajvok

  • cc ajvok1@… added
  • status changed from closed to reopened
  • resolution worksforme deleted

I am seeing this same problem and appear to have later versions than those reported to work above.

I start pavucontrol. My headset is shown, and works, but: 1. Its mono only 2. The record volume is way too loud. I figured this *may* be fixed by changing the configured profile from the profile from HSP/HSF to a2dp. When I try doing this in pavucontrol/configuration screen I get a popup "Connection Failed: Connection Terminated". Trying this again, but with log-level=debug provides these final lines in debug: ================================================= I: module-device-restore.c: Restoring volume for sink bluez_sink.00_11_B1_07_A6_3A. I: module-device-restore.c: Restoring mute state for sink bluez_sink.00_11_B1_07_A6_3A. I: sink.c: Created sink 3 "bluez_sink.00_11_B1_07_A6_3A" with sample spec s16le 6ch 44100Hz and channel map front-left,front-left-of-center,front-center,front-right,front-right-of-center,rear-center I: sink.c: bluetooth.protocol = "a2dp" I: sink.c: device.description = "jabra BT3030" I: sink.c: device.string = "00:11:B1:07:A6:3A" I: sink.c: device.api = "bluez" I: sink.c: device.class = "sound" I: sink.c: device.bus = "bluetooth" I: sink.c: device.form_factor = "headset" I: sink.c: bluez.path = "/org/bluez/19123/hci0/dev_00_11_B1_07_A6_3A" I: sink.c: bluez.class = "0x240404" I: sink.c: bluez.name = "jabra BT3030" I: sink.c: device.icon_name = "audio-headset-bluetooth" I: module-device-restore.c: Restoring volume for source bluez_sink.00_11_B1_07_A6_3A.monitor. I: module-device-restore.c: Restoring mute state for source bluez_sink.00_11_B1_07_A6_3A.monitor. I: source.c: Created source 6 "bluez_sink.00_11_B1_07_A6_3A.monitor" with sample spec s16le 6ch 44100Hz and channel map front-left,front-left-of-center,front-center,front-right,front-right-of-center,rear-center I: source.c: device.description = "Monitor of jabra BT3030" I: source.c: device.class = "monitor" I: source.c: device.string = "00:11:B1:07:A6:3A" I: source.c: device.api = "bluez" I: source.c: device.bus = "bluetooth" I: source.c: device.form_factor = "headset" I: source.c: bluez.path = "/org/bluez/19123/hci0/dev_00_11_B1_07_A6_3A" I: source.c: bluez.class = "0x240404" I: source.c: bluez.name = "jabra BT3030" I: source.c: device.icon_name = "audio-headset-bluetooth" D: module-bluetooth-device.c: IO Thread starting up D: core-util.c: SCHED_RR|SCHED_RESET_ON_FORK worked. I: core-util.c: Successfully enabled SCHED_RR scheduling for thread, with priority 5. D: module-bluetooth-device.c: Sending BT_REQUEST -> BT_START_STREAM D: module-bluetooth-device.c: Trying to receive message from audio service... D: module-bluetooth-device.c: Received BT_RESPONSE <- BT_START_STREAM D: module-bluetooth-device.c: Trying to receive message from audio service... D: module-bluetooth-device.c: Received BT_RESPONSE <- BT_NEW_STREAM D: module-bluetooth-device.c: Stream properly set up, we're ready to roll! E: sink.c: Assertion 'pa_frame_aligned(length, &s->sample_spec)' failed at pulsecore/sink.c:1090, function pa_sink_render_full(). Aborting. =================================================

I'm running Mandriva Linux 2010. That came with pulseaudio 0.9.19. After having this problem, I upgraded to 0.9.21 - that did not help. I'm using module-bluetooth-discover

Other package versions: $ rpm -qa | grep blue bluez-alsa-4.54-1mdv2010.0 bluez-firmware-1.2-6mdv2010.0 bluez-gstreamer-4.54-1mdv2010.0 libbluez3-4.54-1mdv2010.0 bluez-hcidump-1.42-3mdv2010.0 libbluez-devel-4.54-1mdv2010.0 bluez-cups-4.54-1mdv2010.0 pulseaudio-module-bluetooth-0.9.21-0.0.4mdv2010.0 bluez-4.54-1mdv2010.0 kbluetooth-0.4-1.RC1.3mdv2010.0 bluez-pin-0.30-9mdv2010.0

$ rpm -qa | grep alsa bluez-alsa-4.54-1mdv2010.0 libalsa2-devel-1.0.21a-1mdv2010.0 java-1.6.0-sun-alsa-1.6.0.16-1mdv2010.0 libalsa-data-1.0.21a-1mdv2010.0 alsa-plugins-pulse-config-1.0.21-2mdv2010.0 libalsa2-1.0.21a-1mdv2010.0 alsa-plugins-doc-1.0.21-2mdv2010.0 libalsa-plugins-1.0.21-2mdv2010.0 alsa-utils-1.0.21-1mdv2010.0 libalsa-oss0-1.0.17-4.2mdv2010.0 libalsa-plugins-pulseaudio-1.0.21-2mdv2010.0

Any suggestions? Bug or me being daft?

Thanks for any help.

  Changed 2 years ago by coling

Just for reference, this version of PA 0.9.21 is basically stable-queue as it stands today.

PS: Next time, please use the Preview function and WikiFormatting :)

  Changed 2 years ago by ajvok

No idea why, but when I set
default-sample-channels=2
in daemon.conf the problem goes away (I can now select a2dp in pavucontrol without pulseaudio crashing).
For some reason in my linux distro (Mandriva 2010) default-sample-channels was set to 6.

While that closes the issue for me, I don' think this ticket should be closed until pulseaudio is prevented from crashing with this configuration.

BTW: What do you mean by "stable-queue"? Thanks.

Changed 19 months ago by samr7

Potential fix

  Changed 13 months ago by murz

Same problem when switching to a2dp on pulseaudio 1:0.9.22-0ubuntu2~diwic:

Jan 22 13:08:52 kit pulseaudio[32599]: core-util.c: RealtimeKit worked.
Jan 22 13:08:52 kit pulseaudio[32599]: core-util.c: Successfully enabled SCHED_RR scheduling for thread, with priority 5.
Jan 22 13:08:52 kit pulseaudio[32599]: module-bluetooth-device.c: Sending BT_REQUEST -> BT_START_STREAM
Jan 22 13:08:52 kit pulseaudio[32599]: module-bluetooth-device.c: Trying to receive message from audio service...
Jan 22 13:08:52 kit pulseaudio[32599]: module-bluetooth-device.c: Received BT_RESPONSE <- BT_START_STREAM
Jan 22 13:08:52 kit pulseaudio[32599]: module-bluetooth-device.c: Trying to receive message from audio service...
Jan 22 13:08:52 kit pulseaudio[32599]: module-bluetooth-device.c: Received BT_RESPONSE <- BT_NEW_STREAM
Jan 22 13:08:52 kit pulseaudio[32599]: module-bluetooth-device.c: Stream properly set up, we're ready to roll!
Jan 22 13:08:52 kit pulseaudio[32599]: sink.c: Assertion 'pa_frame_aligned(length, &s->sample_spec)' failed at pulsecore/sink.c:1090, function pa_sink_render_full(). Aborting.

setting default-sample-channels=2 works for me, but I use 5.1 surround, so I need default-sample-channels=6 to hear good sound. How can I fix this problem?

  Changed 13 months ago by coling

@murz: The default-sample-channels option isn't really needed these days. Just leave it as the default (to work around your BT crash) and then use gnome-volume-control (Hardware tab) or pavucontrol (configuration tab) to pick a 5.1 Surround profile for your ALSA card.

I didn't notice samr7's patch here... Trac can be a bit rubbish when sending notifications for attachments only :(

  Changed 13 months ago by murz

@coling: if I remove default-sample-channels option, after every pulseaudio restart I must set manually my output device to use surround 5.1 profile from analog stereo duplex.

How I can configure pulseaudio to set surround 5.1 profile for my sound card by default without default-sample-channels?

At now I do this with thouse commands:

default-sample-format = s16le
default-sample-rate = 48000
default-sample-channels = 6
default-channel-map = front-left,front-right,rear-left,rear-right,center,lfe
enable-lfe-remixing = yes

  Changed 13 months ago by coling

@murz: The card profiles are saved in a database file in ~/.pulse/ It will likely end in card-database.tdb (although the file extension may be different). The filename will be prefixed with the dbus machine id (to keep it unique to your machine). I can't think why it wouldn't be restored, so you should check to make sure those files are there.

You would likely still have to set:

default-sample-rate = 48000
enable-lfe-remixing = yes

but the others should be fine as their defaults.

Note: See TracTickets for help on using tickets.