pulse-server: module-zeroconf-publish: do not query twice

Whether the object is a sink or source is already queried at the
beginning of the function, and is kept in local variables.
Use those instead of calling `pw_manager_object_is_{sink,source}()` again.
This commit is contained in:
Barnabás Pőcze 2021-11-06 15:25:06 +01:00
parent 7b0af5940e
commit ce687d6518

View file

@ -274,9 +274,9 @@ static void get_service_data(struct module_zeroconf_publish_data *d,
collect_device_info(o, card, &dev_info, false, &impl->defs); collect_device_info(o, card, &dev_info, false, &impl->defs);
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL) { if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL) {
if (pw_manager_object_is_sink(o)) if (is_sink)
flags |= SINK_HARDWARE; flags |= SINK_HARDWARE;
else if (pw_manager_object_is_source(o)) else if (is_source)
flags |= SOURCE_HARDWARE; flags |= SOURCE_HARDWARE;
} }