pulse-server: improve network and virtual node checks

Tag the sink/source as HARDWARE when it's not virtual, the presence
of a DEVICE_API property is not a good check.

Make a method to check if a node is a NETWORK sink/source to make it
use the same logic everywhere.
This commit is contained in:
Wim Taymans 2023-07-26 11:51:48 +02:00
parent ae4042e7a2
commit 39a1887a0b
5 changed files with 18 additions and 9 deletions

View file

@ -3715,9 +3715,9 @@ static int fill_sink_info(struct client *client, struct message *m,
}
flags = SINK_LATENCY | SINK_DYNAMIC_LATENCY | SINK_DECIBEL_VOLUME;
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL)
if (!pw_manager_object_is_virtual(o))
flags |= SINK_HARDWARE;
if ((str = spa_dict_lookup(info->props, PW_KEY_NODE_NETWORK)) != NULL)
if (pw_manager_object_is_network(o))
flags |= SINK_NETWORK;
if (SPA_FLAG_IS_SET(dev_info.volume_info.flags, VOLUME_HW_VOLUME))
flags |= SINK_HW_VOLUME_CTRL;
@ -3927,9 +3927,9 @@ static int fill_source_info(struct client *client, struct message *m,
}
flags = SOURCE_LATENCY | SOURCE_DYNAMIC_LATENCY | SOURCE_DECIBEL_VOLUME;
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL)
if (!pw_manager_object_is_virtual(o))
flags |= SOURCE_HARDWARE;
if ((str = spa_dict_lookup(info->props, PW_KEY_NODE_NETWORK)) != NULL)
if (pw_manager_object_is_network(o))
flags |= SOURCE_NETWORK;
if (SPA_FLAG_IS_SET(dev_info.volume_info.flags, VOLUME_HW_VOLUME))
flags |= SOURCE_HW_VOLUME_CTRL;