[pulseaudio-discuss] Extra A2DP codecs support in bluetooth module

Pali Rohár pali.rohar at gmail.com
Sun Jul 22 09:31:51 UTC 2018

On Sunday 22 July 2018 10:14:21 Georgi Boiko wrote:
> Hi Pali,
> Does it have to be codec switching?

Without codec switching it is not possible to "force" specific codec.
And when bluetooth headset initiate connection, then headset choose
codec. My testing shown me that my bluetooth headset chooses codec
"randomly" when pulseaudio declares that support both SBC and aptX.

And no, it is not a good idea to have "random" codec selection without
possibility to switch it.

So the only possible solution for now for enforcing aptX codec is to
disable SBC codec registration to bluez. And codec registration is
global for all headset and is done when initializing pulseaudio
bluetooth module.

> If there was to be an implementation
> that settles on the best quality codec available that is supported by both
> sides of communication

This is possible to implement, but only in the case that
pulseaudio/bluez initiate connection to bletooth headset.

For my tested headset, this is possible only when putting headset into
bluetooth "pairing" mode. Very unpractical. In normal case, that headset
is what initialize connection.

> it would already be over and beyond what currently
> exists. The order is obvious as of today:

For me it is not such obvious as you specified.

> AptX HD
> AptX

In case I have music already in MPEG/AAC then this codec should have the
higher priority as music could be passed as-is without decoding and
reencoding. In this case it is the best possible quality. Same would be
for MPEG/MP3 codec.

Technically there are also other codecs supported by bluetooth headset,
see my research:

I have no clue right now where to put aptX Low Latency and FastStream
codecs. Plus both codecs are somehow special that misuse A2DP protocol
and optionally supports backchannel for microphone voice. So you can use
them instead of HFP for voice calls. I have there a headset with
FastStream codec and IIRC it is just some variant of SBC, so I would try
to play with it.

And I'm still in doubt if MPEG/AAC does not provide better quality as

> BlueZ already follows this logic, it is just that PA does not register any
> capabilities other than SBC.
> Allowing forced codec selection through the GUI is nice to have, but given
> the complexity of implementing it, may not be worth the hassle for the
> initial milestone.
> On 22/07/18 09:51, Pali Rohár wrote:
> > Hi!
> > 
> > On Sunday 22 July 2018 00:10:47 Georgi Boiko wrote:
> > > Hi,
> > > 
> > > Does anybody know what happened after this discussion? Is this long overdue
> > > upgrade on the roadmap?
> > > 
> > > https://lists.freedesktop.org/archives/pulseaudio-discuss/2017-July/028398.html
> > See this thread:
> > https://lists.freedesktop.org/archives/pulseaudio-discuss/2018-July/030198.html
> > 
> > Basically there is a patch for aptX support, but that one just replace
> > SBC by aptX. So need to decide which codec to support at compile time.
> > 
> > This is current limitation of bluez - linux bluetooth daemon - which
> > does not support codec switching.
> > 
> > See also this thread:
> > https://lists.freedesktop.org/archives/pulseaudio-discuss/2018-July/030253.html
> > 
> > So until bluez is extended to support switching and configuring A2DP
> > codec, there would not be support for any other codec then SBC.
> > 

Pali Rohár
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20180722/882d4f4a/attachment.sig>

More information about the pulseaudio-discuss mailing list