[pulseaudio-discuss] [PATCH] WIP: Bluetooth A2DP aptX codec support

Pali Rohár pali.rohar at gmail.com
Sun Jul 8 20:34:16 UTC 2018


On Sunday 08 July 2018 23:11:56 Luiz Augusto von Dentz wrote:
> Hi Pali,
> 
> On Sun, Jul 8, 2018 at 11:02 PM, Pali Rohár <pali.rohar at gmail.com> wrote:
> > On Sunday 08 July 2018 22:55:28 Luiz Augusto von Dentz wrote:
> >> Hi Pali,
> >>
> >> On Sat, Jul 7, 2018 at 2:08 PM, Pali Rohár <pali.rohar at gmail.com> wrote:
> >> > On Friday 06 July 2018 11:16:09 Pali Rohár wrote:
> >> >> Known problems:
> >> >>
> >> >> For every A2DP codec it is needed to register endpoint to the bluez daemon.
> >> >> This is working fine, but I do not know how and why bluez daemon choose
> >> >> endpoint (and so codec) for new connection. And I have not figured out how
> >> >> to tell bluez daemon to switch A2DP codec from SBC to aptX and vice-versa.
> >> >> It looks like that bluez daemon chooses endpoint (and so codec) at
> >> >> connection time randomly :-(
> >> >
> >> > Any idea how to tell bluez which endpoint should use? Or how to change
> >> > one active bluez endpoint to another for switching bluez codec?
> >>
> >>
> >> It is the order PA register the endpoints, if you want apt-x take
> >> priority register it first.
> >
> > Do you mean to call functions in this order?
> >
> > register_endpoint(y, path, A2DP_SOURCE_APTX_ENDPOINT, ...);
> > register_endpoint(y, path, A2DP_SOURCE_SBC_ENDPOINT, ...);
> >
> > No, it does not work. Still codec is somehow selected randomly.
> > Sometimes aptX, sometimes SBC. I tested it with one same device.
> 
> https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/profiles/audio/a2dp.c#n1866
> 
> It is definitely not random in our end, note that this only works if
> you initiate the connection, if the remote initiates it then it is up
> to them to select which may explain why it is not always the same
> priority.

So if remote side initiate the connection, then we have no control which
codec is chosen in case pulseaudio register more endpoints?

And how to switch from one codec to another when there is an active
connection? E.g. device supports both aptX and SBC, but it initiated
connection and chose SBC -- and now I want to use aptX.

Endpoint registration is global, not device specific, right? It means
that we cannot set different priority for different A2DP devices?

What I would like is to change A2DP codec in pavucontrol (or pactl or
any other PA application) and currently my patch uses one pulseaudio
profile for SBC and one for aptX. So it is possible to implement such
switching based on changing profile?

Or do you have a better idea how to select/change A2DP profile via
pavucontrol/pactl/KDE sound app/...?

-- 
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/20180708/356ba3cb/attachment.sig>


More information about the pulseaudio-discuss mailing list