We have moved to a new Sailfish OS Forum. Please start new discussions there.

LDAC support for better audio

asked 2019-03-18 23:31:31 +0300

soloist gravatar image

Sony has been releasing LDAC codec to AOSP. Would it be possible to add support for this?


edit retag flag offensive close delete



Actually implementing LDAC support requires two things: 1) Bluez must have support for multiple BT audio codecs, and the ability to choose/switch the active codec. Bluez patches have been merged, so they're included in the upstream git tree, but they're not yet in any official released bluez version. 2) Pulseaudio BT support must be able to use the bluez multi audio codec support aswell, and obviously be able to use the LDAC library from AOSP. Those pulseaudio patches are still under development, and there has been multiple versions posted to pulseaudio mailing list by Pali, who's trying to get the patches working properly and upstreamed.

So currently (as of March 2019) to test LDAC support you need to compile latest version of bluez from git, and also apply the work-in-progress pulseaudio patches and build a custom version of pulseaudio aswell.

pasikarkkainen ( 2019-03-21 20:51:03 +0300 )edit

6 Answers

Sort by » oldest newest most voted

answered 2019-03-19 00:12:25 +0300

r0kk3rz gravatar image

updated 2019-03-19 01:01:17 +0300

Well spotted!

There might be some issues around the patent encumbered codecs being included in the same package, but lets see if I can get the required things packaged and built and go from there.

EDIT: Ok so the libldac library was rather easy, but I think the Pulse Audio module that adds the required glue might be a bit trickier due to their massive reworking of the BT module and relicensing... I hope they are planning on getting their work upstreamed into PA proper instead of continually maintaining a fork of the BT module

edit flag offensive delete publish link more


Good work! Thanks for looking into this.

soloist ( 2019-03-19 08:18:08 +0300 )edit

answered 2019-11-03 14:33:18 +0300

pasikarkkainen gravatar image

Update 2019/11: bluez 5.52 has been released recently, and it includes support for multiple bluetooth A2DP audio codecs, and switching between them. The related APIs have been declared as stable in bluez v5.52.

Pulseaudio patches to utilize the bluez support for multiple A2DP codecs is currently at the 13th revision, and is still being reviewed/discussed on pulseaudio-discuss mailinglist.

edit flag offensive delete publish link more


thanks for the update

r0kk3rz ( 2019-11-04 01:38:02 +0300 )edit

answered 2019-05-11 15:48:37 +0300

pasikarkkainen gravatar image

So.. support for multiple bluetooth A2DP audio codecs (including LDAC) is being worked upstream right now. It is partly done/merged, and some bits are still missing or work-in-progress currently (as of writing this, 2019-05-11). You can basicly "split" the required work in two main parts:

1) bluez support for multiple bluetooth A2DP audio codecs. Bluez needs to be able to discover/negotiate/parse different codecs, transport them, offer ability to choose/switch active codecs, remember last used codecs during BT reconnects, etc. Bluez does not need to actually encode/decode audio for these codecs, that's the job of bluez clients (like Pulseaudio), because bluez basicly just "transports" the encoded audio. This bluez work is mostly done and merged to upstream bluez git repository (in master branch, not yet in any released version). You can see the merged A2DP multiple audio codec patches here (commits after Dec 2018): https://git.kernel.org/pub/scm/bluetooth/bluez.git/log/?qt=grep&q=a2dp

2) Pulseaudio support for multiple bluetooth A2DP audio codecs, and ability to utilize the bluez provided support for handling multiple A2DP codecs. Pulseaudio is the client for bluez, so it's pulseaudio who must be able to encode/decode audio using various codecs, which means Pulseaudio needs to use various codec libraries to encode/decode audio using different codecs, and allow end-user to choose/configure which codec to use, etc. Currently the "groundwork" patches to support multiple A2DP audio codecs in Pulseaudio has been merged (during the last month or so), but the actual support for LDAC, AptX-HD, AptX, FastStream, and high-quality SBC codec is still a work-in-progress. More review and testing is needed to get the rest of the patches merged to upstream Pulseaudio. Currently the remaining pulseaudio patches are at 10th revision atm. You can find the patches for example here: https://lists.freedesktop.org/archives/pulseaudio-discuss/2019-May/031100.html (from: https://lists.freedesktop.org/archives/pulseaudio-discuss/2019-May/ ).

BT A2DP multiple audio codecs development work is mostly done by developers Pali and Luiz. You can find the discussions/reviews/patches on linux-bluetooth and pulseaudio mailing lists.

audio codec libraries used/required: - https://github.com/pali/libopenaptx - https://android.googlesource.com/platform/external/libldac / https://github.com/EHfive/ldacBT

edit flag offensive delete publish link more

answered 2019-03-19 06:41:08 +0300

Oleg gravatar image

no sense. LDAC and others, it's marketing. I'm sorry, it's in Russian, but with images https://habr.com/ru/post/433724/

edit flag offensive delete publish link more



Yup, the ideal would be plain stereo PCM (16 bits, sample rate at least above 40kHz) for connection that can sustain 1.2Mbps, FLAC for everything else (more channels or lower bandwidth), and OPUS for lossy (even lower bandwitdh). ( ^- OPUS currently beats everything at common bandwidth. Except for some very limited low bandwith where the open source Codec2 is the one beating the crap of everything else).

The problem is: no hardware manufacturer is even going to build it, every body is in the "license shitty commercial patent-encumbered codecs".

Your earphone are going to be stuck a AptX, LDAC, etc. So you're stuck with needing to implement those on your smartphone.

DrYak ( 2019-03-19 11:51:57 +0300 )edit

@Oleg, Thanks for the link - very informative, though my Russian is a bit rusty.

deloptes ( 2019-05-13 17:52:59 +0300 )edit

@deloptes, I hope you get the gist from the pictures and links. Maximum possible bitrate is 345 kbps for SBC for this moment.

Oleg ( 2019-05-14 17:58:52 +0300 )edit

@Oleg, well not so rusty that I could not read, but reading is not that fast as usual and the article was pretty long - but very very informative.

You know, I prefer cables at home - no dubious radiation. For a phone call 345Kbps is just fine. For good music quality I have two good boxes wired to a good amplifier. I gave up old bulb one cause it is hard and costy to maintain. Why would I listen to music that causes radiation? Anyway. Cheers!

deloptes ( 2019-05-14 23:29:41 +0300 )edit

@deloptes, yes, I agree. There is only one advantage: it's the absence of wires. Radiation of BT is negligible against other electromagnetic fields at home.

Oleg ( 2019-05-15 07:54:41 +0300 )edit

answered 2019-03-19 07:16:33 +0300

xbt123ufo gravatar image

I think I really need ldac. The Android of xa2 plus owns excellent Bluetooth quality which is important to me, but I lost it after flashing to sailfish. If sailfish x can add ldac in the future, I will enjoy it very much.

edit flag offensive delete publish link more


Sony is a crook company - they have always been. I would have bought anything else but Sony device if I had the choice.

deloptes ( 2019-05-13 17:54:56 +0300 )edit

answered 2019-05-09 03:33:03 +0300

Bala7s gravatar image

I already have an LDAC compatible headphone and Tidal HiFi subscription, having support this would be another thing where I wouldn't need an Android phone to carry alongside with my XA2. So I strongly support it!

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools



Asked: 2019-03-18 23:31:31 +0300

Seen: 1,056 times

Last updated: Nov 03 '19