[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] bluetooth: Ensure that only one A2DP codec is registered to bluez
Arun Raghavan
gitlab at gitlab.freedesktop.org
Fri Mar 20 00:52:45 UTC 2020
Arun Raghavan pushed to branch master at PulseAudio / pulseaudio
Commits:
d5047443 by Pali Rohár at 2020-03-19T14:02:40+01:00
bluetooth: Ensure that only one A2DP codec is registered to bluez
Support for multiple codecs needs to use a new Bluez API which pulseaudio
does not implement yet.
So register explicitly only SBC codec which is provided by pulseaudio A2DP
codec API.
- - - - -
1 changed file:
- src/modules/bluetooth/bluez5-util.c
Changes:
=====================================
src/modules/bluetooth/bluez5-util.c
=====================================
@@ -944,8 +944,9 @@ static void parse_interfaces_and_properties(pa_bluetooth_discovery *y, DBusMessa
pa_assert(dbus_message_iter_get_arg_type(&iface_i) == DBUS_TYPE_ARRAY);
if (pa_streq(interface, BLUEZ_ADAPTER_INTERFACE)) {
+
+ const pa_a2dp_codec *a2dp_codec_sbc;
pa_bluetooth_adapter *a;
- unsigned a2dp_codec_i;
if ((a = pa_hashmap_get(y->adapters, path))) {
pa_log_error("Found duplicated D-Bus path for adapter %s", path);
@@ -960,20 +961,13 @@ static void parse_interfaces_and_properties(pa_bluetooth_discovery *y, DBusMessa
if (!a->valid)
return;
- /* Order is important. bluez prefers endpoints registered earlier.
- * And codec with higher number has higher priority. So iterate in reverse order. */
- for (a2dp_codec_i = pa_bluetooth_a2dp_codec_count(); a2dp_codec_i > 0; a2dp_codec_i--) {
- const pa_a2dp_codec *a2dp_codec = pa_bluetooth_a2dp_codec_iter(a2dp_codec_i-1);
- char *endpoint;
-
- endpoint = pa_sprintf_malloc("%s/%s", A2DP_SINK_ENDPOINT, a2dp_codec->name);
- register_endpoint(y, a2dp_codec, path, endpoint, PA_BLUETOOTH_UUID_A2DP_SINK);
- pa_xfree(endpoint);
-
- endpoint = pa_sprintf_malloc("%s/%s", A2DP_SOURCE_ENDPOINT, a2dp_codec->name);
- register_endpoint(y, a2dp_codec, path, endpoint, PA_BLUETOOTH_UUID_A2DP_SOURCE);
- pa_xfree(endpoint);
- }
+ /* Currently only one A2DP codec is supported, so register only SBC
+ * Support for multiple codecs needs to use a new Bluez API which
+ * pulseaudio does not implement yet, patches are waiting in queue */
+ a2dp_codec_sbc = pa_bluetooth_get_a2dp_codec("sbc");
+ pa_assert(a2dp_codec_sbc);
+ register_endpoint(y, a2dp_codec_sbc, path, A2DP_SINK_ENDPOINT "/sbc", PA_BLUETOOTH_UUID_A2DP_SINK);
+ register_endpoint(y, a2dp_codec_sbc, path, A2DP_SOURCE_ENDPOINT "/sbc", PA_BLUETOOTH_UUID_A2DP_SOURCE);
} else if (pa_streq(interface, BLUEZ_DEVICE_INTERFACE)) {
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/d504744396316c4b05f477327feb36095f5e68cb
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/d504744396316c4b05f477327feb36095f5e68cb
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20200320/871cb963/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list