ubports / ubuntu-touch

Ubuntu Touch's issue inbox is now migrated to GitLab.
https://gitlab.com/ubports/ubuntu-touch
1.28k stars 110 forks source link

Audio isn't routed properly to bluetooth headset when reconnecting #1045

Closed kugiigi closed 3 years ago

kugiigi commented 5 years ago

Steps to reproduce

  1. Connect bluetooth headset
  2. Open Music app and play a song.
  3. Disconnect bluetooth headset
  4. Reconnect bluetooth headset
  5. Resume playing the song from the music ap

Expected behavior

The song continues to play in the bluetooth headset

Actual behavior

The song plays in the speaker instead

Logfiles and additional information

This wasn't an issue before. Not sure if it only started in xenial but it really did work fine in vivid. Restarting the music app makes it work again.

hummlbach commented 5 years ago

Observed the same on turbo.

UniversalSuperBox commented 5 years ago

I can confirm this on the Nexus 5. It seems that audio routing is switched away from Bluetooth properly but not back to it. Closing and reopening the app playing sound will fix the issue, but that's annoying.

vokaliz commented 5 years ago

Hello! I have same problem on my meizu pro 5 ubuntu 16.04 stable OTA-8. I am using Caraudio bluetooth from Belkin. First connection - ok, after off car and start again second connection with meizu bluetooth - no. I am just rebooting ubuntu and conection - ok.

Fozzimoto commented 5 years ago

Same problem on mako, nexus 4 .. youtube does this and i have to reaload app if i turn off bluetooth and back on again... close it and open again to re-bluetooth audio.

mariogrip commented 5 years ago

I have pushed the latest version (5.50) of bluez to xenial_-_new-bluez please try this to see if it fixes the issue :)

sudo ubports-qa install xenial_-_new-bluez

Chuffedas commented 5 years ago

I have the same witha nexus 5. starts and works fine when first pair. switch van off and it seems that the phone becomes the receiver not the emitter.

The van cant find phone and phone says it is connected to van.

deleting phone from van doesn't work. have to make phone forget van.

abkro commented 4 years ago

Tested on N5 hammerhead today. Running devel 20200602-30971.

Booted device. Established connection to external BT speaker Bose SoundLink Mini Started playing song from Cloud Music app. Sound played on Bose speaker. Broke BT connection from settings>Bluetooth menu. Reconnected to Bose speaker + hit 'play.

The sound now came from the device.

Closed app. Reopened app, found song, hit 'play'.

The song still played from the device, even though the speaker was connected.

I then switched off Bose speaker. Connected device to Philips Sound Bar (HTL9100). Hit play in the still open Sound Cloud app. The sound played on the Philips speakers. Broke BT connection from menu again. Reestablished connection. Hit play in app. Now the sound came from the device. Closed app Reopened app. Found song again and hit play. This time the sound came from the Philips speakers again.

abkro commented 4 years ago

Tested once more on Nexus 5. This time I did the test on two different cars, attempting to make phone calls from these. I also played music in one of them. Here are the steps I did and results:

  1. Establishing connection to car: Connected to Hyundai Ioniq by putting the in-car BT in visible/search mode and selecting the car from the device's BT menu. BT connection established.
  2. Attempted to make a phone call. The sound was never routed to the in-car media system. Instead I heard the ringtone on the device itself. The phone was connected to bluetooth until the other party answered. At that moment it disconnected.
  3. I reconnected and repeated the process.Same result.

Next I switched cars.

  1. Establishing connection to Tesla model S: The device had previously been connected to this car and was remembered, but the connection did not get established automatically. First I tried from the device, selecting the car from previous connections. 2 attempts. Both failed. Then I selected the device from the in-car media system. Connection established on first attempt.
  2. I placed a call. Sound was routed to the in-car media system, but was hopelessly garbled, both before the other party answered and after, making conversation impossible. The connection was not lost, but it was impossible to understand what was being said on the other end. That person, however, was able to hear what I said, albeit not well. She described the connection as intermittent and partly garbled.
  3. Playing media file: I started the Cloud Music app, but had to turn off wifi to get a cellular data connection first. I then chose a song and played it. The sound came from the in-car media system, clear and smooth. I disconnected the device from the BT menu on the device, while leaving the app open. I reconnected, but once again had to choose the device from the car's menu instead of the other way around. Once the connection was established, I tried to continue playing the song. Now the sound came from the device, not the car. I then closed the app, reopened it, selected the song and played once more. This time the sound came from the car media system.

I will send you the logs, @peat-psuwit. Hope this helps!

ubuntu-touch-testing commented 4 years ago

Confirmed also, I need to Close App AND Force Disconnect the Bluetooth Headset from the Setttings specifically. Any other combination fails to play sound on the reconnected headset.

Sucessfull Bluetooth Headset Recconnect: Close app, Force disconnect bluetooth headset from Ubuntu Touch Settings, Leave headset powered on, Force reconnect bluetooth headset from Ubuntu Touch Settings, Reopen app: Sound from bluetooth headset. Menu Path used: Ubuntu Touch --> System Settings --> Bluetooth --> Select Bluetooth Headset --> Disconnect. Reconnect by re-choosing device after disconnected. Would probably work if bluetooth headset was powered down also after forcing disconnect, but it seems to be the forcing the disconnect from the OS that fixes the problem.

I would guess that the forcing disconnect from OS is doing an internal resetting step that is missing from the auto-disconnect when the device is powered down.

IMPORTANT: Note my Failed Test 5! It seems that when bluetooth is connected but not playing sound, that the OS is messed up concerning the bluetooth connection because the OS failed to reboot and I had to force it and it is now messed up.

Failed Test 1: Powercycle Headset, THEN Restart app after headset reconnects Headset connected, App open, Close app, Reopen app: Sound from Phone.

Failed Test 2: Power cycle bluetooth headset App opened and leave it open, Headset connected, Powerdown headset, Bluetooth disconnects automatically, Powerup headset, Bluetooth recconnects automatically: Sound from Phone.

Failed Test 3: Restart app and power cycle bluetooth headset App opened, Headset connected, Close app, Powerdown Headset, Bluetooth disconnects automatically, Powerup headset, Bluetooth recconnects automatically, Reopen app: Sound from Phone.

Failed Test 4: Power cycle headset only while it is playing correctly, bluetooth automatically disconnects. After the headset rautomatically recconnects, sound plays from the phone.

Failed Test 5: Power off phone with the bluetooth connected but not correctly playing sound, phone failed to reboot, seemed frozen on black screen off, but was actually still connected to the headset. I had to force it to reboot into bootloaded and now the screen is offset from the touch... to be continued.

Nexus 5 Ubuntu Touch 16.04 LTS OS Build Number: 2020-06-16 UBports Image part: 20200615-3756 Audio Apps Tested: Podbird & UTmedia video

ubuntu-touch-testing commented 4 years ago

So it seems that if I powercycle the bluetooth headset (thus the OS automatically disconnects it reconnects it), it reconnects bluetooth but the sound is incorrectly playing from the phone and not the headset. If I reboot the OS with the headset still powered on and incorrectly connected, the OS sometimes starts with the screen offset upwards by about 20% but not the touch. After screen lock timeout, the offset seems to autocorrect. However, if I powercycle the headset AFTER the phone restart, it recconnects but does not play sound.

Working Workaround: In ALL cases, if I force disconnect the bluetooth headset and force recconnect it from Ubuntu Touch OS Settings AND start the sound app after the OS based forced recconnection, the sound correctly plays from the bluetooth headset.

Failed Test 6: Force disconnect and reconnect bluetooth headset leaving App open. Connect headset, open app, sound playing from headset, pause music, manually force headset disconnect from OS settings, leave headset powered on, manually force reconnect headset, play music, sound playing from phone.

peat-psuwit commented 3 years ago

Call for testing: Pulseaudio Bluetooth headset audio routing (if you still follow this bug) Please install the PR then reboot. Follow the test plan here: https://wiki.ubuntu.com/Process/Merges/TestPlan/pulseaudio

sudo mount -t tmpfs tmpfs /var/cache/apt/archives
sudo ubports-qa install pulseaudio-packaging 5
sudo reboot
j2g2rp commented 3 years ago

I have a question about this. This is for audio routing for calls or also for music app?

Flohack74 commented 3 years ago

If you read the initial comment its about music playback. I dont think anybody would take off and reattach the BT headset during a call, so nobody tried. But it will be a similar issue. Though much harder to fix ;)

TellingBerto commented 3 years ago

Device: VollaPhone Channel: RC Build: 2020-W43

Steps processed

  1. Connect bluetooth headset (Logitech Headset LH800)
  2. Open Music app and play a song.
  3. Disconnect bluetooth headset
  4. Reconnect bluetooth headset
  5. Resume playing the song from the music app

Remarks:

  1. When disconnecting bluetooth headset (by switching off the head set/or deactivating bt on the phone) the music app stops playing the song.
  2. No music is played on the speaker instead.
  3. Headset automatically re-connected (when the auto connection setting is flaged)

Result: Works as expected.

Many thanks.