mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
bluez5: don't probe native backend presence
Don't do a blocking probe of native backend presence, because it may trigger DBus activation for Bluez. If the DBus activation fails, it ends up blocking until timeout. ofono/hsphfpd usually don't have DBus activation configured, so they fail instantly (which is why this problem was not encountered, even though they do blocking calls on startup in previous pipewire versions too). Instead, select the backend once we have Bluez objects listed.
This commit is contained in:
parent
40487e485d
commit
0af3c85806
2 changed files with 3 additions and 36 deletions
|
|
@ -2142,38 +2142,6 @@ static const struct spa_bt_backend_implementation backend_impl = {
|
|||
.supports_codec = backend_native_supports_codec,
|
||||
};
|
||||
|
||||
static bool is_available(struct impl *backend)
|
||||
{
|
||||
DBusMessage *m, *r;
|
||||
DBusError err;
|
||||
bool success = false;
|
||||
|
||||
m = dbus_message_new_method_call(BLUEZ_SERVICE, "/org/bluez",
|
||||
DBUS_INTERFACE_INTROSPECTABLE, "Introspect");
|
||||
if (m == NULL)
|
||||
return false;
|
||||
|
||||
dbus_error_init(&err);
|
||||
r = dbus_connection_send_with_reply_and_block(backend->conn, m, -1, &err);
|
||||
dbus_message_unref(m);
|
||||
|
||||
if (r && dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_METHOD_RETURN) {
|
||||
const char *str;
|
||||
if (dbus_message_get_args(r, &err, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID)) {
|
||||
success = strstr(str, BLUEZ_PROFILE_MANAGER_INTERFACE) != NULL;
|
||||
} else {
|
||||
dbus_error_free(&err);
|
||||
}
|
||||
}
|
||||
|
||||
if (r)
|
||||
dbus_message_unref(r);
|
||||
else
|
||||
dbus_error_free(&err);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
struct spa_bt_backend *backend_native_new(struct spa_bt_monitor *monitor,
|
||||
void *dbus_connection,
|
||||
const struct spa_dict *info,
|
||||
|
|
@ -2236,8 +2204,6 @@ struct spa_bt_backend *backend_native_new(struct spa_bt_monitor *monitor,
|
|||
}
|
||||
#endif
|
||||
|
||||
backend->this.available = is_available(backend);
|
||||
|
||||
return &backend->this;
|
||||
|
||||
#ifdef HAVE_BLUEZ_5_BACKEND_HFP_NATIVE
|
||||
|
|
|
|||
|
|
@ -3546,6 +3546,8 @@ static void get_managed_objects_reply(DBusPendingCall *pending, void *user_data)
|
|||
dbus_message_iter_next(&it[1]);
|
||||
}
|
||||
|
||||
reselect_backend(monitor);
|
||||
|
||||
monitor->objects_listed = true;
|
||||
|
||||
finish:
|
||||
|
|
@ -4146,12 +4148,11 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
register_media_application(this);
|
||||
|
||||
/* Create backends. They're started after we get a reply from Bluez. */
|
||||
this->backends[BACKEND_NATIVE] = backend_native_new(this, this->conn, info, this->quirks, support, n_support);
|
||||
this->backends[BACKEND_OFONO] = backend_ofono_new(this, this->conn, info, this->quirks, support, n_support);
|
||||
this->backends[BACKEND_HSPHFPD] = backend_hsphfpd_new(this, this->conn, info, this->quirks, support, n_support);
|
||||
|
||||
reselect_backend(this);
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue