[xenial] A2DP profile still alive even though disconnected

Bug #1711605 reported by Chanho Park
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

During connect/disconnect with BT headset repeatedly, the bluetooth connection(check using hcitool) is still alive even thoush the connection has been disconnected by bluetoothctl. The hsp profile is still connected on pulseaudio.

---

Since the pulseaudio of Xenial has been updated from 8.0-0ubuntu3.2 to 8.0-0ubuntu3.3 at last May, I failed my TestCase The test case is just repeating connect/disconnect with BT headset through bluetoothctl.
The change[1] can be retrieved from Xenial's pulseaudio source but I can't ensure which patch causes the problem.
You can see the error log[2] when the error has been occurred.

[1] pulseaudio (1:8.0-0ubuntu3.3) xenial; urgency=medium

  [Luke Yelavich, Konrad Zapałowicz]
  * Fixed multiple interrelated problems with using Bluetooth audio (A2DP),
    where users would experience some combination of:
    - Bluetooth headset/speakers listed but not selectable in Sound settings
      (LP: #1283003)
    - [regression] Bluetooth audio no longer supports A2DP (stuck in HSP/HFP
      mode) (LP: #1438510)
    - [xenial] Bluetooth device doesn't play any sound in A2DP mode unless set
      to HSP/HFP first (LP: #1582213)
  * Specific patches from upstream used to address the above problems:
    - 0103-bluetooth-Add-support-for-automatic-switch-between-h.patch
    - 0104-bluetooth-Add-support-for-automatic-switch-bluez5.patch
    - 0106-bluetooth-Add-optional-heuristic-for-switching-betwe.patch
      . Backport from upstream to fix a bug in Xenial where an incorrect
        audio profile is applied for a headset connected over Bluetooth
        making using it impossible.
    - 0105-bluetooth-policy-do-A2DP-profile-restoring-a-bit-lat.patch
      . Fix a crash that happens if the BT headset is the only non-monitor
        source in the system and the last "phone" stream dies.
    - 0700-pulsecore-add-new-card-profile-hook.patch
      . Backport from upstream (commit 7b6260140149) to allow for correct
        profile selection.
    - 0701-bluetooth-bluez5-wait-for-all-profiles-to-connect.patch
      . Backport from upstream waiting for all profiles to connect before
        creating a card.

 -- Daniel van Vugt <email address hidden> Tue, 23 May 2017 16:24:14 +0800

[2] Error log
D: [pulseaudio] backend-native.c: dbus: path=/Profile/HSPAGProfile, interface=org.bluez.Profile1, member=NewConnection
D: [pulseaudio] backend-native.c: dbus: NewConnection path=/org/bluez/hci0/dev_00_18_09_2C_1F_41, fd=18
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd18 state changed from disconnected to idle
D: [pulseaudio] backend-native.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd18 available for profile headset_head_unit
D: [pulseaudio] backend-native.c: RFCOMM << AT+VGS=07
D: [pulseaudio] backend-native.c: RFCOMM >> OK
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=SelectConfiguration
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Introspectable found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaTransport1 found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=SetConfiguration
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd6 state changed from disconnected to idle
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd6 available for profile a2dp_sink
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_00_18_09_2C_1F_41
D: [pulseaudio] backend-native.c: dbus: path=/Profile/HSPAGProfile, interface=org.bluez.Profile1, member=RequestDisconnection
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=ClearConfiguration
D: [pulseaudio] bluez5-util.c: Clearing transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd6 profile a2dp_sink
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd6 state changed from idle to disconnected
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Introspectable found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaTransport1 found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=SetConfiguration
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd7 state changed from disconnected to idle
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd7 available for profile a2dp_sink
D: [pulseaudio] bluez5-util.c: Properties changed in transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd7
D: [pulseaudio] bluez5-util.c: Timeout expired, and device /org/bluez/hci0/dev_00_18_09_2C_1F_41 still has disconnected profiles: a2dp_source
D: [pulseaudio] module-bluez5-discover.c: Loading module-bluez5-device path=/org/bluez/hci0/dev_00_18_09_2C_1F_41
I: [pulseaudio] card.c: Created 1 "bluez_card.00_18_09_2C_1F_41"
D: [pulseaudio] module-bluez5-device.c: Created card (current profile headset_head_unit)
D: [pulseaudio] module-bluez5-device.c: Initializing profile headset_head_unit
D: [pulseaudio] module-bluez5-device.c: profile headset_head_unit
D: [pulseaudio] module-bluez5-device.c: profile headset_head_unit transport 0x3c2dc1b0 transport state idle
D: [pulseaudio] module-bluez5-device.c: Acquiring transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd18
I: [pulseaudio] backend-native.c: doing connect

[3] Normal log
D: [pulseaudio] backend-native.c: dbus: path=/Profile/HSPAGProfile, interface=org.bluez.Profile1, member=NewConnection
D: [pulseaudio] backend-native.c: dbus: NewConnection path=/org/bluez/hci0/dev_00_18_09_2C_1F_41, fd=18
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd18 state changed from disconnected to idle
D: [pulseaudio] backend-native.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd18 available for profile headset_head_unit
D: [pulseaudio] backend-native.c: RFCOMM << AT+VGS=07
D: [pulseaudio] backend-native.c: RFCOMM >> OK
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=SelectConfiguration
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Introspectable found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaTransport1 found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=SetConfiguration
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd0 state changed from disconnected to idle
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd0 available for profile a2dp_sink
D: [pulseaudio] backend-native.c: dbus: path=/Profile/HSPAGProfile, interface=org.bluez.Profile1, member=RequestDisconnection
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=ClearConfiguration
D: [pulseaudio] bluez5-util.c: Clearing transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd0 profile a2dp_sink
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd0 state changed from idle to disconnected
I: [pulseaudio] backend-native.c: Lost RFCOMM connection.
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd18 state changed from idle to disconnected
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_00_18_09_2C_1F_41
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_00_18_09_2C_1F_41
D: [pulseaudio] bluez5-util.c: Timeout expired, and device /org/bluez/hci0/dev_00_18_09_2C_1F_41 still has disconnected profiles: a2dp_sink, a2dp_source, headset_head_unit
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_00_18_09_2C_1F_41
D: [pulseaudio] backend-native.c: dbus: path=/Profile/HSPAGProfile, interface=org.bluez.Profile1, member=NewConnection
D: [pulseaudio] backend-native.c: dbus: NewConnection path=/org/bluez/hci0/dev_00_18_09_2C_1F_41, fd=18
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd18 state changed from disconnected to idle
D: [pulseaudio] backend-native.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd18 available for profile headset_head_unit
D: [pulseaudio] backend-native.c: RFCOMM << AT+VGS=07
D: [pulseaudio] backend-native.c: RFCOMM >> OK
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=SelectConfiguration
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Introspectable found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaTransport1 found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=SetConfiguration
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd1 state changed from disconnected to idle
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd1 available for profile a2dp_sink
D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_00_18_09_2C_1F_41
D: [pulseaudio] backend-native.c: dbus: path=/Profile/HSPAGProfile, interface=org.bluez.Profile1, member=RequestDisconnection
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSource, interface=org.bluez.MediaEndpoint1, member=ClearConfiguration
D: [pulseaudio] bluez5-util.c: Clearing transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd1 profile a2dp_sink
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_00_18_09_2C_1F_41/fd1 state changed from idle to disconnected

Tags: a2dp xenial
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Can you please clarify what the problem is you are reporting, in a few sentences?

Changed in pulseaudio (Ubuntu):
status: New → Incomplete
Revision history for this message
Chanho Park (chanho61.park) wrote :

Okay. I can summarize what the problem is.

During connect/disconnect with BT headset repeatedly, the bluetooth connection(check using hcitool) is still alive even thoush the connection has been disconnected by bluetoothctl. The hsp profile is still connected on pulseaudio.

description: updated
Changed in pulseaudio (Ubuntu):
status: Incomplete → New
tags: added: a2dp
tags: added: xenial
Revision history for this message
Chanho Park (chanho61.park) wrote :

Hi,

The "0701-bluetooth-bluez5-wait-for-all-profiles-to-connect.patch" which you picked from the upstream has a bug and it has been already fixed at mainline by the same author.

Please pick below patch to address this problem.

https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=cb78d6f57c00f3694dae9110f7a7d6f80e3344ac

https://bugs.freedesktop.org/show_bug.cgi?id=100237

Revision history for this message
Chanho Park (chanho61.park) wrote :

Hi,

You picked wrong patch for "bluetooth: Add optional heuristic for switching between hsp and a2dp profiles"[1]
Originally, it was written without "bluetooth-policy: do A2DP profile restoring a bit later"[2] and it was overwritten the [2] code. Please see the patch order and patch result.

- /* If there are still some source outputs do nothing. */
- if (source_output_count(c) > 0)
+ /* If there are still some source outputs do nothing (count is with *this* source_output, so +1) */
+ if (source_output_count(c, userdata) > 1)

[1]: https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=3397127f0045d3c130b59e59b4ce6b3601b239b9
[2]: https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=2250dbfd6968bd9ce295fc7bef8595b2c6ef6a44

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

"I" did not pick those patches :)

But thank you for pointing this out. One of us will look at the problem in detail soon.

summary: - a2dp profile still alive even though disconnected
+ [xenial] A2DP profile still alive even though disconnected
Revision history for this message
Chanho Park (chanho61.park) wrote :

Hi Daniel,

Sorry for late response. This issue has been resolved since pulseaudio-8.0-0ubuntu3.4 version.
Thanks for fixing the issue.

pulseaudio (1:8.0-0ubuntu3.4) xenial; urgency=medium

  * debian/control: Update Vcs fields to launchpad git.
  * Cherrypick fixes for common crashes from upstream:
    - cb78d6f5: SIGABRT in device_start_waiting_for_profiles (LP: #1690028,
      LP: #1672171)
    - d985276c: SIGABRT in pa_alsa_path_set_volume (LP: #1539209, LP: #1562817)

 -- Daniel van Vugt <email address hidden> Fri, 11 Aug 2017 15:16:57 +0800

Changed in pulseaudio (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.