bluetooth: Prevent registration of an unavailable codec at runtime
authorSanchayan Maity <sanchayan@asymptotic.io>
Fri, 1 Jan 2021 14:08:48 +0000 (19:38 +0530)
committerSanchayan Maity <sanchayan@asymptotic.io>
Tue, 19 Jan 2021 08:13:42 +0000 (13:43 +0530)
commit8289bdb76ddcb7673b16338ebc45f71a7955c00f
tree33a4d9658acada7d49b34de15bc9b74976c063d6
parentd61493640e8ec82a188d33f6ae07a8dbe46c34c1
bluetooth: Prevent registration of an unavailable codec at runtime

When it comes to codecs provided via GStreamer, we register all codecs
if GStreamer option is enabled for bluez5 via meson. However, the
GStreamer plugin required for the codec might not be present on the
system. This results in the codec being available for registration with
the bluez stack or selection by the user, but, trying to use the said
codec then fails.

To prevent the above, we now use the can_be_supported codec API to check
if the codec is usable and if not, we do not register the said codec and
also prevent users from switching to it.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/440>
src/modules/bluetooth/bluez5-util.c
src/modules/bluetooth/module-bluez5-device.c