media-session: if no node found on reconnect, unlink but no error

If a reconnecting node was linked at least once successfully, and a
re-link ends up not finding any node to link to, don't raise an error.
Instead, just unlink the node, and wait for a suitable sink to appear
later.

This fixes the issue that some Pulseaudio apps have to be restarted
if all devices go away, before they start working.

It also seems like the right thing to do, because if you remove links
manually, this does not cause errors to occur.
This commit is contained in:
Pauli Virtanen 2021-08-07 19:11:31 +03:00 committed by Wim Taymans
parent 8028f9dd6e
commit 83f72489ad

View file

@ -906,8 +906,14 @@ static int rescan_node(struct impl *impl, struct node *n)
if (!reconnect) {
pw_log_info("don-reconnect target node destroyed: destroy %d", n->id);
sm_media_session_destroy_object(impl->session, n->id);
} else if (reconnect && n->connect_count > 0) {
/* Don't error the stream on reconnects */
pw_log_info(NAME " %p: no node found for %d, waiting reconnect", impl, n->id);
if (n->peer != NULL)
unlink_nodes(n, n->peer);
return 0;
} else {
pw_log_warn("no node found for %d", n->id);
pw_log_warn(NAME " %p: no node found for %d, stream error", impl, n->id);
}
obj = sm_media_session_find_object(impl->session, n->client_id);