[pulseaudio-discuss] [PATCH v9 0/8] Bluetooth A2DP codecs
pali.rohar at gmail.com
Thu Apr 25 11:28:16 UTC 2019
On Thursday 25 April 2019 14:19:15 Luiz Augusto von Dentz wrote:
> Hi Pali,
> On Mon, Apr 22, 2019 at 4:40 PM Pali Rohár <pali.rohar at gmail.com> wrote:
> > In this patch series was dropped all patches which are already applied
> > in git master branch.
> > There are 2 new patches: "Fix A2DP codec API to provide information about
> > data buffer" and "policy: Set initial A2DP profile which bluez already
> > activated".
> > So with profile/codec switching we can relay on bluez functionality of
> > remembering the last used codec.
> > Changes in v9:
> > * Fix parsing uuids of remote SEP endpoints
> > * Remove wrong assert in FastStream codec
> > * Fix logic in SBC codec for checking if two config/capabilities are
> > compatible
> > * Split SBC UHQ into two sub-codecs - it is needed to ensure that
> > remote endpoint does not choose bitpool for dualchannel configuration
> > (38) and channel mode for stereo configuration -- which is SBC middle
> > quality configuration
> > * Simplify encode and decode functions for aptX codec
> > * Change FastStream codec code which handles bugs in firmware
> > * Fix A2DP codec API to provide information about data buffer
> > * Ensure that module-bluez5-discover does not unload
> > module-bluez5-device when codec switching operation is in progress
> > * Set initial A2DP profile which bluez already activated
> > Pali Rohár (8):
> > bluetooth: Fix A2DP codec API to provide information about data buffer
> > bluetooth: Add A2DP aptX and aptX HD codecs support
> > bluetooth: Add A2DP FastStream codec support
> > bluetooth: Add more variants of SBC codec
> > bluetooth: policy: Reflect a2dp profile names
> > bluetooth: Implement A2DP codec switching and backchannel support
> > bluetooth: policy: Treat bi-directional A2DP profiles as suitable for
> > VOIP
> > bluetooth: policy: Set initial A2DP profile which bluez already
> > activated
> > configure.ac | 36 ++
> > src/Makefile.am | 8 +
> > src/modules/bluetooth/a2dp-codec-api.h | 17 +-
> > src/modules/bluetooth/a2dp-codec-aptx.c | 400 +++++++++++++
> > src/modules/bluetooth/a2dp-codec-faststream.c | 453 ++++++++++++++
> > src/modules/bluetooth/a2dp-codec-sbc.c | 751 +++++++++++++++++++-----
> > src/modules/bluetooth/a2dp-codec-util.c | 26 +-
> > src/modules/bluetooth/bluez5-util.c | 476 ++++++++++++++-
> > src/modules/bluetooth/bluez5-util.h | 39 +-
> > src/modules/bluetooth/module-bluetooth-policy.c | 152 +++--
> > src/modules/bluetooth/module-bluez5-device.c | 440 +++++++++-----
> > src/modules/bluetooth/module-bluez5-discover.c | 3 +-
> > 12 files changed, 2416 insertions(+), 385 deletions(-)
> > create mode 100644 src/modules/bluetooth/a2dp-codec-aptx.c
> > create mode 100644 src/modules/bluetooth/a2dp-codec-faststream.c
> > --
> > 2.11.0
> These seems to work great, I can even switch on the fly the profiles
> and after a short delay it switches without a problem, there is one
> issue related to reconnecting though:
> With BlueZ remembering the last used endpoint (aptX) it seems the
> policy ignores that and reverts to highest priority (SBC UHQ),
This is default behavior for all newly created "card" in pulseaudio.
pulseaudio itself choose initial profile which has the highest priority.
See file card.c.
Other modules may override this default behavior. One module is
module-card-restore, but this one ignores all bluetooth cards unless is
loaded by special parameter.
Other module which override initial profile is module-bluetooth-policy
and you can see in the last patch, that it choose initial profile to one
which bluez already activated.
So if this does not work, then problem is in the last patch and it needs
to be fixed.
> I recommend to leave the last used endpoint when reconnecting and not
> try to revert it to back to the highest priority,
This is exactly job of the last patch. So seems it does not work for
> well in fact I don't
> think we need to evaluate priorities anymore since the policy in BlueZ
> will be to always connect to the last endpoint (in case of being the
> initiator), except perhaps for the very first time we had connected in
> which case there is no last used in which case BlueZ will use the
> registration order as priority.
Priority is evaluated by pulseaudio core and it is default behavior for
all pulseaudio cards. This is basically needed. For bluetooth we just
need to fix the last patch in this series if it does not work correctly.
pali.rohar at gmail.com
More information about the pulseaudio-discuss