bluetooth: switch_codec should start with pa_blueooth_device_

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/521>
This commit is contained in:
Marijn Suijten 2021-01-24 14:10:16 +01:00
parent a82e019de9
commit cefee393fb
3 changed files with 5 additions and 5 deletions

View file

@ -305,7 +305,7 @@ struct switch_codec_data {
void *userdata; 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; DBusMessage *r;
pa_dbus_pending *p; pa_dbus_pending *p;
pa_bluetooth_discovery *y; 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; 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, pa_hashmap *capabilities_hashmap, const pa_a2dp_codec *a2dp_codec,
void (*codec_switch_cb)(bool, pa_bluetooth_profile_t profile, void *), void *userdata) { void (*codec_switch_cb)(bool, pa_bluetooth_profile_t profile, void *), void *userdata) {
DBusMessageIter iter, dict; 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->cb = codec_switch_cb;
data->userdata = userdata; 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; return true;
} }

View file

@ -184,6 +184,7 @@ void pa_bluetooth_transport_unlink(pa_bluetooth_transport *t);
void pa_bluetooth_transport_free(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_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_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); 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); 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); 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) { 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); return pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS) || pa_streq(uuid, PA_BLUETOOTH_UUID_HSP_HS_ALT);

View file

@ -2494,7 +2494,7 @@ static int bluez5_device_message_handler(const char *object_path, const char *me
stop_thread(u); 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) && !u->device->codec_switching_in_progress)
goto profile_off; goto profile_off;