mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
bluetooth: Avoid PA_BLUETOOTH_DEVICE_HOOK_REMOVED
The hook PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED gets fired also when a device is being removed, so there is actually no need to have this duplicated hook.
This commit is contained in:
parent
0a8068d28e
commit
c8944dbb4b
1 changed files with 5 additions and 20 deletions
|
|
@ -147,7 +147,6 @@ struct userdata {
|
|||
pa_bluetooth_transport *transport;
|
||||
char *accesstype;
|
||||
pa_hook_slot *transport_removed_slot;
|
||||
pa_hook_slot *device_removed_slot;
|
||||
pa_hook_slot *discovery_slot;
|
||||
|
||||
pa_bluetooth_discovery *discovery;
|
||||
|
|
@ -2571,17 +2570,6 @@ static int setup_dbus(struct userdata *u) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Run from main thread */
|
||||
static pa_hook_result_t device_removed_cb(pa_bluetooth_device *d, void *call_data, struct userdata *u) {
|
||||
pa_assert(d);
|
||||
pa_assert(u);
|
||||
|
||||
pa_log_debug("Device %s removed: unloading module", d->path);
|
||||
pa_module_unload(u->core, u->module, TRUE);
|
||||
|
||||
return PA_HOOK_OK;
|
||||
}
|
||||
|
||||
/* Run from main thread */
|
||||
static pa_hook_result_t discovery_hook_cb(pa_bluetooth_discovery *y, const pa_bluetooth_device *d, struct userdata *u) {
|
||||
pa_assert(u);
|
||||
|
|
@ -2590,10 +2578,13 @@ static pa_hook_result_t discovery_hook_cb(pa_bluetooth_discovery *y, const pa_bl
|
|||
if (d != u->device)
|
||||
return PA_HOOK_OK;
|
||||
|
||||
if (pa_bluetooth_device_any_audio_connected(d))
|
||||
if (d->dead)
|
||||
pa_log_debug("Device %s removed: unloading module", d->path);
|
||||
else if (!pa_bluetooth_device_any_audio_connected(d))
|
||||
pa_log_debug("Unloading module, because device %s doesn't have any audio profiles connected anymore.", d->path);
|
||||
else
|
||||
return PA_HOOK_OK;
|
||||
|
||||
pa_log_debug("Unloading module, because device %s doesn't have any audio profiles connected anymore.", d->path);
|
||||
pa_module_unload(u->core, u->module, true);
|
||||
|
||||
return PA_HOOK_OK;
|
||||
|
|
@ -2669,9 +2660,6 @@ int pa__init(pa_module* m) {
|
|||
if (!(device = find_device(u, address, path)))
|
||||
goto fail;
|
||||
|
||||
u->device_removed_slot = pa_hook_connect(&device->hooks[PA_BLUETOOTH_DEVICE_HOOK_REMOVED], PA_HOOK_NORMAL,
|
||||
(pa_hook_cb_t) device_removed_cb, u);
|
||||
|
||||
u->discovery_slot = pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery), PA_HOOK_NORMAL,
|
||||
(pa_hook_cb_t) discovery_hook_cb, u);
|
||||
|
||||
|
|
@ -2770,9 +2758,6 @@ void pa__done(pa_module *m) {
|
|||
if (u->discovery_slot)
|
||||
pa_hook_slot_free(u->discovery_slot);
|
||||
|
||||
if (u->device_removed_slot)
|
||||
pa_hook_slot_free(u->device_removed_slot);
|
||||
|
||||
if (USE_SCO_OVER_PCM(u))
|
||||
restore_sco_volume_callbacks(u);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue