[Deprecated] [TESTING] Bluetooth audio streaming (A2DP)

I know that Bluetooth Audio in the past being tied to PulseAudio has led to issues with Hifiberry compatibility.

Stumbled on this today: https://github.com/sretlawd/btaudio

Basically an implementation of Bluetooth Audio for OpenELEC that specifically doesn’t require pulseaudio. Would this potentially help in getting HifiBerry compatibility down the track?

Hello, I’ve been following this topic recently. Initially trying out various “Instructables” for bluetooth before implementing the solution here “wget http://paste.osmc.io/raw/qiyekuvafe -O- | sudo sh”.

My setup is as follows:
Raspberry Pi 2
Osmc latest
CRS bluetooth
TP-Link wifi
Hifiberry DAC+

Everything works extremely well for me with the only exception being a lack of volume control from either andriod phone or OSMC ( heard Sam say it should work with Android but i’ve had no luck at all with several different devices running Android 4.2 and above). Suprisingly sound is working with great effect from my Hifiberry while running bluetooth from phone to the rpi ( system/audio Alsa bluetooth setting enabled) and with the Hifiberry set as the overlay in rpi config settings, everything else should be as default, i’ve not messed with much else besides number of channels/sound quaility and visual settings.

So for me the only thing I would like to see a solution for is external volume control through bluetooth ( have to use the volume on the amp currently).

Is there any way to get this working?

Great work Sam and the team.

I have an iPhone now. Have the same problem. Need to work on AVRCP implementation. It will land soon.

Sam

Hi,

I have a weird problem. I want to stream audio to OSMC from my smartphone. Everything is working, but I can only get output from the analogue port. I just cannot get audio output from the HDMI port. I tried to install alsa-utils to change the audio sink but nothing changed. Does somebody have the same problem and knows how to solve it?

Cheers

good news, looking forward to it, thanks for your efforts.

Great work! I use and follow this project (osmc) since it’s beginning.
I’m a big fan of what you guys are doing here!! :slight_smile:

I tested my self this feature with an old usb dongle… it’s kind of slow, it has some delays, maybe because is not BT 4.0.
Is there any chance to have this running with PI3 BT driver that is in development ?

It would be nice to use the built-in pi3 BT for A2DP :smiley:

As I have pointed you over from the RPI3 Bluetooth thread obviously what is described in here in testing will work with the RPi3 Dongle after the upcoming update.

You mean with the built-in one cause with the dongle works already.
It is very logical, if onboard BT works this should work as well, but the reason why I asked is that I saw some comment from Sam saying that built-in BT will support file transfer…I tough only that … :slight_smile:

Yes with the build in one

Anyone here been able to connect a Windows 10 laptop ?
I can stream from my android phone flawlessly, but can’t even connect to my Asus UX32A laptop with Windows 10…
I’m using the Pi3 with inbuilt bluetooth.

How to remove this package my hifiberry digi isn’t working any more

pls help!

I have no problem at all. Acer Switch 11 with Core i3. Win 10 x64. I did of course had to enable discovery again via MyOsmc and I also enabled “allow devices to find this computer” on my laptop. Works fine.

After a recent release and providing support to RPi’s onboard Bluetooth chip I was trying to stream audio to a bluetooth speaker (Philips OTR 7500). I was able to find the device, pair & connect to it but after few seconds it keeps disconnecting. This is probably the same problem as @ytandogan described in https://discourse.osmc.tv/t/raspberry-pi-3-bluetooth-mega-thread/13977

In journalctl I saw some errors:
Suspend: Connection timed out (110)
Abort: Connection timed out (110)

Any ideas?

The changelog for OSMC 2016.04-01 says:

  • Improved A2DP Bluetooth audio streaming
  • Updated to BlueZ 5.38

What has changed? And does BlueZ mean we won’t need PulseAudio in the near future? (thus enabling the goodies from HiFiberry like AMP and DAC?) Or is that not related at all?

I tried the new release yesterday and am able to pair my Pi 3 with my phone.
Once starting to stream from my phone to OSMC I hear the music but it starts immediately to stutter, and sounds quicker than the original music is. Sometimes it simply stops until I stop the playback on my phone and start it again (with the same result).
I have no issues with other bluetooth devices (bluetooth speaker, car audio,…) when streaming from my phone.
The app I’m streaming from is Amazon Prime Music on Android. Streaming from another app (like YouTube) seems to work, but I guess there are different codecs/bitrates involved causing the issue.

I checked the kodi.log in debug but it does not show anything. But journalctl contains the appended output.
The lines at the end (“frame assembly failed”) repeat quite often so I took only some of them.

Hope that helps finding the issue.
Thanks again for the great support!

Apr 04 17:39:50 osmc bluetoothd[422]: /org/bluez/hci0/dev_C0_EE_FB_59_04_C1/fd0: fd(20) ready
Apr 04 17:39:50 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually nothing to write!
Apr 04 17:39:50 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-sink.c: Most likely this is a bug in the ALSA driver '(null)'. Please report this issue to the ALSA developers.
Apr 04 17:39:50 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
Apr 04 17:39:53 osmc kernel: input: C0:EE:FB:59:04:C1 as /devices/virtual/input/input4
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c: snd_pcm_delay() returned a value that is exceptionally large: -2070740 bytes (-11738 ms).
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c: Most likely this is a bug in the ALSA driver '(null)'. Please report this issue to the ALSA developers.
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c: snd_pcm_dump():
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c: Hardware PCM card 0 'bcm2835 ALSA' device 0 subdevice 0
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c: Its setup is:
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   stream       : PLAYBACK
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   access       : MMAP_INTERLEAVED
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   format       : S16_LE
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   subformat    : STD
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   channels     : 2
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   rate         : 44100
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   exact rate   : 44100 (44100/1)
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   msbits       : 16
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   buffer_size  : 4408
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   period_size  : 1104
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   period_time  : 25034
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   tstamp_mode  : ENABLE
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   period_step  : 1
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   avail_min    : 1104
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   period_event : 1
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   start_threshold  : -1
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   stop_threshold   : 1155530752
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   silence_threshold: 0
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   silence_size : 0
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   boundary     : 1155530752
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   appl_ptr     : 490084
Apr 04 17:40:12 osmc pulseaudio[255]: E: [alsa-sink-bcm2835 ALSA] alsa-util.c:   hw_ptr       : 485676

Apr 04 17:41:21 osmc pulseaudio[255]: W: [pulseaudio] module-loopback.c: Sample rates too different, not adjusting (44100 vs. 78987).
Apr 04 17:41:27 osmc pulseaudio[255]: E: [bluetooth] module-bluez5-device.c: SBC decoding error (-3)

Apr 04 17:42:32 osmc kernel: Bluetooth: hci0: Frame reassembly failed (-90)

Apr 04 17:42:32 osmc pulseaudio[255]: E: [bluetooth] module-bluez5-device.c: SBC decoding error (-2)
Apr 04 17:42:32 osmc kernel: Bluetooth: hci0: Frame reassembly failed (-84)
Apr 04 17:42:32 osmc kernel: Bluetooth: hci0 SCO packet for unknown connection handle 9156
Apr 04 17:42:32 osmc kernel: Bluetooth: hci0: Frame reassembly failed (-84)
Apr 04 17:42:32 osmc kernel: Bluetooth: hci0: Frame reassembly failed (-84)
Apr 04 17:42:32 osmc kernel: Bluetooth: hci0: Frame reassembly failed (-84)

Just after the laest update I can’t connect to my BT dongle - It connects for a few seconds then disconnects presumably a problem with the bluetooth system and the new update?

Can I just re write the previous version on to the card and re-install the bluetooth stuff?

Here is the log file output as I try and connect.

06:10:55 1136.383423 T:1877607408 WARNING: CActiveAE::StateMachine - signal: 1 from port: OutputDataPort not handled for state: 1
06:11:00 1141.884277 T:1877607408 WARNING: Previous line repeats 2 times.
06:11:00 1141.884644 T:1877607408   ERROR: ActiveAE::InitSink - failed to init
06:11:00 1141.884888 T:1877607408 WARNING: CActiveAE::StateMachine - signal: 1 from port: OutputDataPort not handled for state: 1
06:11:06 1147.386108 T:1877607408 WARNING: Previous line repeats 4 times.
06:11:06 1147.386353 T:1877607408   ERROR: ActiveAE::InitSink - failed to init
06:11:06 1147.386597 T:1877607408 WARNING: CActiveAE::StateMachine - signal: 1 from port: OutputDataPort not handled for state: 1
06:11:11 1152.888428 T:1877607408   ERROR: ActiveAE::InitSink - failed to init
06:11:13 1155.039185 T:1520165872   ERROR: DoWork - Direct texture file loading failed for resource://resource.images.weathericons.default/.png
06:11:17 1158.389648 T:1877607408   ERROR: ActiveAE::InitSink - failed to init
06:11:17 1158.390747 T:1877607408 WARNING: CActiveAE::StateMachine - signal: 13 from port: OutputControlPort not handled for state: 1
06:11:22 1163.891968 T:1877607408   ERROR: ActiveAE::InitSink - failed to init
06:11:28 1169.393433 T:1877607408   ERROR: Previous line repeats 1 times.
06:11:28 1169.394287 T:1877607408 WARNING: CActiveAE::StateMachine - signal: 1 from port: OutputDataPort not handled for state: 1
06:11:33 1174.895508 T:1877607408 WARNING: Previous line repeats 5 times.
06:11:33 1174.896606 T:1877607408   ERROR: ActiveAE::InitSink - failed to init

awesome! it works perfectly and stable :slight_smile:
no need for my scriptwork i posted in late october!

only thing i have trouble is to get it re-connecting after reboot…
no idea how to make a cron Job? would be a systemd service/timer not better?

Worked great on PI2 until the latest update (2016.04-01). Now my Bluetooth headset connects and then instantly disconnects (logs can be found here: http://paste.osmc.io/zepanojafo)

Would appreciate any idea.

Thanks!
Adi

Update: downgraded OSMC, and the problem disappears

1 Like

Similar issue here after the last update

I have the same problem of @adilei with April upgrade Now my Bluetooth headset connects and then instantly disconnects. Thanks

1 Like