policy-node: give more priority to newer video output nodes

A slight workaround for old firefox that doesn't specify the target
node, nor the media role when doing screen sharing.
This commit is contained in:
Wim Taymans 2020-02-06 17:42:52 +01:00
parent 3aa8e301c5
commit 88c6db8a82

View file

@ -208,8 +208,15 @@ handle_node(struct impl *impl, struct sm_object *object)
else else
return 0; return 0;
if (strstr(media_class, "Video") == media_class) if (strstr(media_class, "Video") == media_class) {
if (direction == PW_DIRECTION_OUTPUT) {
if ((str = pw_properties_get(object->props, PW_KEY_NODE_PLUGGED)) != NULL)
node->plugged = pw_properties_parse_uint64(str);
else
node->plugged = SPA_TIMESPEC_TO_NSEC(&impl->now);
}
node->active = true; node->active = true;
}
node->direction = direction; node->direction = direction;
node->type = NODE_TYPE_STREAM; node->type = NODE_TYPE_STREAM;
@ -278,6 +285,8 @@ static void session_create(void *data, struct sm_object *object)
struct impl *impl = data; struct impl *impl = data;
int res; int res;
clock_gettime(CLOCK_MONOTONIC, &impl->now);
if (strcmp(object->type, PW_TYPE_INTERFACE_Node) == 0) if (strcmp(object->type, PW_TYPE_INTERFACE_Node) == 0)
res = handle_node(impl, object); res = handle_node(impl, object);
else else
@ -516,7 +525,6 @@ static void session_rescan(void *data, int seq)
struct impl *impl = data; struct impl *impl = data;
struct node *node; struct node *node;
clock_gettime(CLOCK_MONOTONIC, &impl->now);
pw_log_debug(NAME" %p: rescan", impl); pw_log_debug(NAME" %p: rescan", impl);
spa_list_for_each(node, &impl->node_list, link) spa_list_for_each(node, &impl->node_list, link)