From 83f72489ad43d25172804ab13b03e73ed00886fa Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 7 Aug 2021 19:11:31 +0300 Subject: [PATCH] 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. --- src/examples/media-session/policy-node.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/examples/media-session/policy-node.c b/src/examples/media-session/policy-node.c index 1e3c7f621..0130b3ded 100644 --- a/src/examples/media-session/policy-node.c +++ b/src/examples/media-session/policy-node.c @@ -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);