Bluetooth audio reliability issues -- paired+connected, but no sound

  • Hello there,

    I'd like to enquire about reliability issues I've had on LE with Bluetooth audio output.

    What happens is that the first time I use a Bluetooth headset all is well, but once I've finished watching whatever and switch off the headset to put it on charge the LE audio output seems to break. The symptom is that all future audio output is completely silent. This includes HDMI, analogue, and Bluetooth outputs, even when cycling through them to try and cause whatever audio backend LE uses to restart. It also includes when the original headset is reconnected fully.

    Well, I say silent, but not completely. UI and media audio doesn't play at all, but the "null" background sound is still audible, including the audio you hear with the "Send low volume noise" setting.

    So far the only workarounds I've come across is either hard-reboot LE or cycle through half a dozen (or more) media files. -- The latter option will sometimes cause the LE audio output to kind of restart itself, in that a loud burst of backlogged UI sounds play in parallel, and the media's audio plays as normal until the next time the Bluetooth headset is disconnected.

    This isn't quite the same as LE Settings Addon Crashes, though getting the Plugable USB Bluetooth adapter solved that. -- Using a USB Bluetooth adapter also solved a slightly different issue I experienced with the Pi's built-in Bluetooth device whereby audio output would play fine over Bluetooth for a random duration (anything from a few seconds to 10ish minutes) then go completely silent as per my current issue.

    Would there be any recommendations for stabilizing Bluetooth audio output, or would this be a real issue?

    This issue seems to impact LE versions 9.0 and 9.2 equally. My Pi is model 3 B+. My Kodi log is here: 2019-12-09 19:06:49.560 T:1937637392 NOTICE: ---------------------------------- - Pastebin.com

    If you require further details please let me know.

    Thanks for reading.

  • I can confirm this issue with some restrictions/additions for both 9.0 and 9.2 on Raspberry Pi 3B+ :

    • This only happens for me when playing 1080p x265 Video (SW decoded). Overclocked to 1350Hz with a small 5V fan running.
    • I can switch to Analog or HDMI output and that works flawlessly. Using Bluetooth again needs reboot.
    • Libreelec Settings Plugin reports that there are no Bluetooth adapters available even after turning Bluetooth off and on again.

    Could this be related to power issues causing the onboard bluetooth device to malfunction?

    When using specifically a Samsung LevelBox Bluetooth speaker (Model EO SG900) this event causes the device to crash as well (has to be restarted and plays no shutdown chime). Other Bluetooth devices need no reboot so the speaker plays no active role in this. Could be a hint that the Pi sends some malformed packages in the end though?

    Here are regular log:

    kodi.log

    and crash log:

    crash.log

    I have tried to restart bluetoothd (systemctl restart bluetoothd) via ssh without success. I have also tried restarting kodi without success. This is what I get with systemctl status bluetoothd after restarting the service (Failed to set mode: Failed (0x03))

    bluetooth.status.log

    Can I provide anything else?

  • Thanks for the additional information panuh.

    • I've not noticed any patterns or consistency with the media asset being played, and to be honest it didn't cross my mind. -- Most of my videos are h264 or mpeg. All the ones I've found impacted are from 576i (PAL) upto 1080p.
    • I've not done any overclocking on my Pi. I can't really fit a fan on there as I have the TV hat in place, though the firmware overheating icon doesn't show up.
    • I also find that LibreELEC randomly reports no Bluetooth devices.

    I would agree with the possibility of the onboard Bluetooth device not being powered enough, which is what led me to purchase the Plugable USB adapter. I'm not sure how well powered the primary USB hub is on the Pi 3. I do wonder if using a USB adapter really disables the onboard Bluetooth device?

    I'm currently using 3 of the USB ports, the other two used are for a Logitech wireless keyboard/mouse, and a 128 GB flash memory stick. Perhaps if I move the Bluetooth adapter to a pair of ports on its own it'd help, as I believe USB root hubs tend to come as a pair of ports. Otherwise I think an external USB hub with its own power source would be required to resolve that.

    Thanks too for pointing out the "bluetoothd" service. -- I'll give that a manual restart and see if that matters when this problem occurs.

    --

    Update: Looks like the service is just "bluetooth" rather than "bluetoothd". Upon checking its status I found:

    Code
    ● bluetooth.service - Bluetooth service
       Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: disabled)
       Active: inactive (dead)
    Condition: start condition failed at Sat 2019-12-14 17:41:03 GMT; 1s ago
               └─ ConditionPathExists=/storage/.cache/services/bluez.conf was not met

    Restarting the service didn't work. However after doing `touch /storage/.cache/services/bluez.conf` then restarting bluetooth it gives a more promising status:

    I'll see how well audio works shortly!

    Edited once, last by Adambean: Extra service info (December 14, 2019 at 5:43 PM).

  • Update:

    I got an externally powered USB hub. However the Plugable Bluetooth adapter appears to not be detected at all through it. (I used command `lsusb -t` to check.) -- This wasn't directly related to this primary thread topic though, as the USB hub was USB 3, but the Plugable Bluetooth adapter was only USB 1.1 compatible. (I simply chained in a passive USB 2.0 hub between the USB 3.0 hub and USB 1.1 devices to fix that.)


    Anyway, it was now important to switch off the internal device and switch to the external device. You'll need a terminal to do this (e.g. over SSH.) Unfortunately this is quite a manual process though I'm welcome to suggestions to automate this.

    Use command `hciconfig` to discover the logical Bluetooth device addresses and take particular note of the "Bus" value to determine which is internal and which is external. In my case "hci1" is the internal device, shown by the bus "UART". This is a logical address though, so it may appear as "hci0" for you. -- Your external device will have the bus showing as "USB". (Mine was "hci0".)

    To switch off the internal device do `hciconfig hci1 down`, and bring up the external device to `hciconfig hci0 up`. Check the status of these with just `hciconfig`, which should then look similar to this:


    Its very likely at some stage that LibreELEC will try and bring it back up, particularly if you restart the Bluetooth service in LibreELEC settings. A crude workaround for this is to use CRON to bring down the internal Bluetooth device every minute. Make sure the CRON service is enabled in the LibreELEC settings. Then in your terminal press CTRL+L to clear the buffer, then do command `crontab -e` to edit your crontab via the NANO text editor.

    Append the following line to the buffer:

    Code
    * * * * * hciconfig hci1 down && hciconfig hci0 up

    Press CTRL+O to save that, then CTRL+X to exit the editor. You may need to restart the CRON service by using command `systemctl restart cron`, but I'm not sure if that's required. -- Now every minute you will ensure that the internal device is shut down, and the external device is up.


    Now that your external device is active you need to pair up your sound device manually, because the LibreELEC Bluetooth control panel only works with the internal device.

    1. Set the Bluetooth scanning mode: `hciconfig hci0 piscan`
      (This will make your external Bluetooth device discoverable.)
    2. Set the Bluetooth pairing mode to simple (PIN-less): `hciconfig hci0 sspmode 1`
    3. Open the Bluetooth control tool: `bluetoothctl`
      (This is a separate utility and any command you now submit will not appear in the Bash `history`.)
      1. Now ensure your sound device is switched on AND in the "pairing" state.
      2. Start scanning: `scan on` OR list already known devices: `devices`
      3. Find your sound device, e.g. "Device 00:08:2A:F3:B7:98 Vigorun Y3"
      4. Stop scanning: `scan off`
      5. Pair your sound device: `pair 00:08:2A:F3:B7:98`
      6. Trust your sound device (for PIN-less pairing): `trust 00:08:2A:F3:B7:98`
      7. Connect to your sound device: `connect 00:08:2A:F3:B7:98`
      8. Exit the Bluetooth control tool: `exit`

    Your Bluetooth sound device should now show up as a PULSE output via LibreELEC's system settings.

    At this point Bluetooth sound worked as normal, though I've not fully tested how reliable this is in the long run, or whether manual steps to connect up again are required.


    Update (again):

    I've since turned off my headset for charging. When I turned it on it immediately connected up with the external Bluetooth device without any commands necessary.

    There is still the issue of needing to stop/start media half a dozen times to get LibreELEC's sound component to kind of restart itself, but this is significantly better than using the internal Bluetooth device.

    Edited once, last by Adambean (December 24, 2019 at 2:38 PM).

  • A couple of weeks further I thought it'd be worth sharing my experience to date on this issue.

    The problem happens the vast majority of the time your headset reconnects even with an externally powered USB Bluetooth adapter, be it after a full power off, or automatic sleep. -- The external adapter doesn't solve the issue completely, but is just rather better than using the internal adapter. (Not getting hard UI crashes with an external adapter.)

    The biggest inconsistency is resuming sound after reconnecting, which is by far the biggest annoyance of this. Sometimes the following will resolve it as a one off:

    • Seeking to random different points in the video. (Going ahead in large steps has worked more often for me.)
    • Fully stopping playback and restarting the video. (Press the Stop button so you exit to the menu.)
    • Switching to a different media type, e.g. start a music file.
    • Issuing Bluetooth reconnect commands manually via a terminal.

    These are very much in the moment though, so sometimes you'll need to cycle through those steps for 10+ minutes, in which case you might as well do the only solid resolution -- hard reboot.

    I'd be very much interested to hear a comment from a developer or veteran of LibreELEC for some further insight into the problem, and what I could do to resolve it completely.

  • I guess this issue is rare, but for what its worth I've decided to ditch the shoddy Bluetooth implementation and instead use a 3.5mm to Bluetooth transmitter.

    Bluetooth 5.0 Transmitter / Receiver, TaoTronics 2-in-1: Amazon.co.uk: Electronics

    (Plenty of alternative products available.)

    This means LibreELEC sends its audio via HDMI in a very typical way. (I have mine set to HDMI + Analogue.) The TV is then responsible for

    redirecting the input audio to its 3.5mm headphone jack, then finally the above transmitter to send the audio to a Bluetooth headset.

    Advantages are the audio reliability issues are completely gone. Resuming after being idle for a while is instant without any buffering problems. The audio delay can also be reset to zero as this approach seems to be much less laggy.

    So far the only disadvantage is the buttons on your Bluetooth headset (if they have any) will obviously no longer be able to control (pause etc) the playback, but if you've got a CEC capable remote then this is satisfactory.

  • I was using HDMI audio to my TV with the product I bought but it turned out to be unreliable tat. The signal just dropped out all the damn time. Sent it back for a refund and got one of these instead:

    Golvery Bluetooth Transmitter with Digital Optical and: Amazon.co.uk: Electronics

    I use the optical TOSLINK port on my TV to that, then it does a boss job of transmitting that to bluetooth earphones.

    That's a good option if your TV can give Toslink output. Unfortunately my TV doesn't have that...
    The HDMI audio extractor I bought was from EBay (was shipped from Hongkong) and I was doubtful about how it would be - but it works pretty well without any such issue you described. I've seen some people using it without the power adapter it comes with and it still works!

  • Hi everyone

    I'm failing to connect my Bluetooth headset. They work on my phone and laptop but on my libreelec they don't appear in the discovery menu. I'm using version 10 on an i5 system.