mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: more cleanup on impl_clear
Remove dbus filters and close the dbus connection. Closing the connection lets BlueZ to clean up, so we don't call its unregistration API.
This commit is contained in:
parent
1c550d850b
commit
87e06783d1
4 changed files with 37 additions and 2 deletions
|
|
@ -1449,6 +1449,11 @@ static int backend_hsphfpd_free(void *data)
|
|||
struct impl *backend = data;
|
||||
struct hsphfpd_endpoint *endpoint;
|
||||
|
||||
if (backend->filters_added) {
|
||||
dbus_connection_remove_filter(backend->conn, hsphfpd_filter_cb, backend);
|
||||
backend->filters_added = false;
|
||||
}
|
||||
|
||||
if (backend->msbc_supported)
|
||||
dbus_connection_unregister_object_path(backend->conn, HSPHFP_AUDIO_CLIENT_MSBC);
|
||||
dbus_connection_unregister_object_path(backend->conn, HSPHFP_AUDIO_CLIENT_PCM_S16LE_8KHZ);
|
||||
|
|
|
|||
|
|
@ -1629,6 +1629,8 @@ static int backend_native_free(void *data)
|
|||
|
||||
sco_close(backend);
|
||||
|
||||
backend_native_unregister_profiles(backend);
|
||||
|
||||
#ifdef HAVE_BLUEZ_5_BACKEND_HSP_NATIVE
|
||||
dbus_connection_unregister_object_path(backend->conn, PROFILE_HSP_AG);
|
||||
dbus_connection_unregister_object_path(backend->conn, PROFILE_HSP_HS);
|
||||
|
|
|
|||
|
|
@ -745,6 +745,11 @@ static int backend_ofono_free(void *data)
|
|||
{
|
||||
struct impl *backend = data;
|
||||
|
||||
if (backend->filters_added) {
|
||||
dbus_connection_remove_filter(backend->conn, ofono_filter_cb, backend);
|
||||
backend->filters_added = false;
|
||||
}
|
||||
|
||||
dbus_connection_unregister_object_path(backend->conn, OFONO_AUDIO_CLIENT);
|
||||
|
||||
free(backend);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ struct spa_bt_monitor {
|
|||
|
||||
struct spa_hook_list hooks;
|
||||
|
||||
uint32_t count;
|
||||
uint32_t id;
|
||||
|
||||
/*
|
||||
|
|
@ -2824,7 +2823,6 @@ static void unregister_media_application(struct spa_bt_monitor * monitor)
|
|||
{
|
||||
int ret;
|
||||
char *object_path = NULL;
|
||||
dbus_connection_unregister_object_path(monitor->conn, A2DP_OBJECT_MANAGER_PATH);
|
||||
|
||||
for (int i = 0; a2dp_codecs[i]; i++) {
|
||||
const struct a2dp_codec *codec = a2dp_codecs[i];
|
||||
|
|
@ -2844,6 +2842,8 @@ static void unregister_media_application(struct spa_bt_monitor * monitor)
|
|||
free(object_path);
|
||||
}
|
||||
}
|
||||
|
||||
dbus_connection_unregister_object_path(monitor->conn, A2DP_OBJECT_MANAGER_PATH);
|
||||
}
|
||||
|
||||
static int adapter_register_application(struct spa_bt_adapter *a) {
|
||||
|
|
@ -3408,8 +3408,19 @@ static int impl_clear(struct spa_handle *handle)
|
|||
|
||||
monitor = (struct spa_bt_monitor *) handle;
|
||||
|
||||
/*
|
||||
* We don't call BlueZ API unregister methods here, since BlueZ generally does the
|
||||
* unregistration when the DBus connection is closed below. We'll unregister DBus
|
||||
* object managers and filter callbacks though.
|
||||
*/
|
||||
|
||||
unregister_media_application(monitor);
|
||||
|
||||
if (monitor->filters_added) {
|
||||
dbus_connection_remove_filter(monitor->conn, filter_cb, monitor);
|
||||
monitor->filters_added = false;
|
||||
}
|
||||
|
||||
spa_list_consume(t, &monitor->transport_list, link)
|
||||
spa_bt_transport_free(t);
|
||||
spa_list_consume(ep, &monitor->remote_endpoint_list, link)
|
||||
|
|
@ -3437,6 +3448,18 @@ static int impl_clear(struct spa_handle *handle)
|
|||
free((void*)monitor->enabled_codecs.items);
|
||||
spa_zero(monitor->enabled_codecs);
|
||||
|
||||
spa_dbus_connection_destroy(monitor->dbus_connection);
|
||||
monitor->dbus_connection = NULL;
|
||||
monitor->conn = NULL;
|
||||
|
||||
monitor->objects_listed = false;
|
||||
|
||||
monitor->connection_info_supported = false;
|
||||
monitor->enable_sbc_xq = false;
|
||||
monitor->backend_native_registered = false;
|
||||
monitor->backend_ofono_registered = false;
|
||||
monitor->backend_hsphfpd_registered = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue