media-session: handle dont-reconnect

If dont-reconnect is given and a target node, kill the stream when
the target node can't be found.
This commit is contained in:
Wim Taymans 2018-12-14 16:35:57 +01:00
parent 8e969c9d44
commit 4be368c957

View file

@ -1084,14 +1084,22 @@ static int rescan_node(struct impl *impl, struct node *node)
pw_log_debug(NAME " %p: no session found for %d, try node", impl, node->obj.id); pw_log_debug(NAME " %p: no session found for %d, try node", impl, node->obj.id);
n_links = 1; n_links = 1;
peer = find_object(impl, find.path_id); if ((peer = find_object(impl, find.path_id)) != NULL) {
if (peer != NULL && peer->obj.type == PW_TYPE_INTERFACE_Node) { if (peer->obj.type == PW_TYPE_INTERFACE_Node) {
if (peer->media_type == SPA_MEDIA_TYPE_audio) if (peer->media_type == SPA_MEDIA_TYPE_audio)
goto do_link_profile; goto do_link_profile;
else else
goto do_link; goto do_link;
} }
} }
else {
str = spa_dict_lookup(props, "pipewire.dont-reconnect");
if (str != NULL && pw_properties_parse_bool(str)) {
pw_registry_proxy_destroy(impl->registry_proxy, node->obj.id);
return -ENOENT;
}
}
}
if (find.sess == NULL) { if (find.sess == NULL) {
struct client *client; struct client *client;
@ -1101,7 +1109,7 @@ static int rescan_node(struct impl *impl, struct node *node)
client = find_object(impl, node->obj.parent_id); client = find_object(impl, node->obj.parent_id);
if (client && client->obj.type == PW_TYPE_INTERFACE_Client) { if (client && client->obj.type == PW_TYPE_INTERFACE_Client) {
pw_client_proxy_error((struct pw_client_proxy*)client->obj.proxy, pw_client_proxy_error((struct pw_client_proxy*)client->obj.proxy,
node->obj.id, ENOENT, "no session available"); node->obj.id, -ENOENT, "no session available");
} }
return -ENOENT; return -ENOENT;
} }