diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c index bb31d3ecc..9c3f137a1 100644 --- a/src/modules/bluetooth/bluez5-util.c +++ b/src/modules/bluetooth/bluez5-util.c @@ -305,7 +305,7 @@ struct switch_codec_data { void *userdata; }; -static void pa_bluetooth_switch_codec_reply(DBusPendingCall *pending, void *userdata) { +static void pa_bluetooth_device_switch_codec_reply(DBusPendingCall *pending, void *userdata) { DBusMessage *r; pa_dbus_pending *p; pa_bluetooth_discovery *y; @@ -345,7 +345,7 @@ static void pa_bluetooth_switch_codec_reply(DBusPendingCall *pending, void *user device->codec_switching_in_progress = false; } -bool pa_bluetooth_switch_codec(pa_bluetooth_device *device, pa_bluetooth_profile_t profile, +bool pa_bluetooth_device_switch_codec(pa_bluetooth_device *device, pa_bluetooth_profile_t profile, pa_hashmap *capabilities_hashmap, const pa_a2dp_codec *a2dp_codec, void (*codec_switch_cb)(bool, pa_bluetooth_profile_t profile, void *), void *userdata) { DBusMessageIter iter, dict; @@ -409,7 +409,7 @@ bool pa_bluetooth_switch_codec(pa_bluetooth_device *device, pa_bluetooth_profile data->cb = codec_switch_cb; data->userdata = userdata; - send_and_add_to_pending(device->discovery, m, pa_bluetooth_switch_codec_reply, data); + send_and_add_to_pending(device->discovery, m, pa_bluetooth_device_switch_codec_reply, data); return true; } diff --git a/src/modules/bluetooth/bluez5-util.h b/src/modules/bluetooth/bluez5-util.h index a621fa6e0..b6376b470 100644 --- a/src/modules/bluetooth/bluez5-util.h +++ b/src/modules/bluetooth/bluez5-util.h @@ -184,6 +184,7 @@ void pa_bluetooth_transport_unlink(pa_bluetooth_transport *t); void pa_bluetooth_transport_free(pa_bluetooth_transport *t); bool pa_bluetooth_device_any_transport_connected(const pa_bluetooth_device *d); +bool pa_bluetooth_device_switch_codec(pa_bluetooth_device *device, pa_bluetooth_profile_t profile, pa_hashmap *capabilities_hashmap, const pa_a2dp_codec *a2dp_codec, void (*codec_switch_cb)(bool, pa_bluetooth_profile_t profile, void *), void *userdata); pa_bluetooth_device* pa_bluetooth_discovery_get_device_by_path(pa_bluetooth_discovery *y, const char *path); pa_bluetooth_device* pa_bluetooth_discovery_get_device_by_address(pa_bluetooth_discovery *y, const char *remote, const char *local); @@ -191,7 +192,6 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_device_by_address(pa_bluetooth_d pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook); const char *pa_bluetooth_profile_to_string(pa_bluetooth_profile_t profile); -bool pa_bluetooth_switch_codec(pa_bluetooth_device *device, pa_bluetooth_profile_t profile, pa_hashmap *capabilities_hashmap, const pa_a2dp_codec *a2dp_codec, void (*codec_switch_cb)(bool, pa_bluetooth_profile_t profile, void *), void *userdata); static inline bool pa_bluetooth_uuid_is_hsp_hs(const char *uuid) { return pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS) || pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS_ALT); diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index b0ef1b2ed..61831129d 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -2494,7 +2494,7 @@ static int bluez5_device_message_handler(const char *object_path, const char *me stop_thread(u); - if (!pa_bluetooth_switch_codec(u->device, profile, capabilities_hashmap, codec, switch_codec_cb_handler, userdata) + if (!pa_bluetooth_device_switch_codec(u->device, profile, capabilities_hashmap, codec, switch_codec_cb_handler, userdata) && !u->device->codec_switching_in_progress) goto profile_off;