media-session: give bluez5 objects driver.priority

Makes bluez devices as automatic default devices, with priority slightly
larger than alsa devices.  The priority.driver is also used by
pulse-server on determining automatic default devices, when no default
has been manually set.
This commit is contained in:
Pauli Virtanen 2021-01-29 21:52:06 +02:00
parent 8fd120cb23
commit f7db158bd6

View file

@ -132,6 +132,7 @@ static struct node *bluez5_create_node(struct device *device, uint32_t id,
struct pw_impl_factory *factory;
int res;
const char *prefix, *str, *profile, *rules;
int priority;
pw_log_debug("new node %u", id);
@ -177,6 +178,16 @@ static struct node *bluez5_create_node(struct device *device, uint32_t id,
pw_properties_setf(node->props, PW_KEY_NODE_NAME, "%s.%s.%s", prefix, str, profile);
pw_properties_set(node->props, PW_KEY_FACTORY_NAME, info->factory_name);
if (pw_properties_get(node->props, PW_KEY_PRIORITY_DRIVER) == NULL) {
priority = device->priority + 10;
if (strcmp(prefix, "bluez_output") == 0)
priority += 1000;
pw_properties_setf(node->props, PW_KEY_PRIORITY_DRIVER, "%d", priority);
pw_properties_setf(node->props, PW_KEY_PRIORITY_SESSION, "%d", priority);
}
node->impl = impl;
node->device = device;
node->id = id;
@ -408,6 +419,7 @@ static struct device *bluez5_create_device(struct impl *impl, uint32_t id,
device->impl = impl;
device->id = id;
device->priority = 1000;
device->handle = handle;
device->device = iface;
device->props = pw_properties_new_dict(info->props);