From 6116ef84844c94942460018f38ca2e544167bd12 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 Jan 2023 16:45:14 +0100 Subject: [PATCH] impl-port: clear peer buffers in suspend When we clear the buffers on an output port when we clear the port format in suspend, also clear the buffers shared by the peer input port mixers because else they would reference old stale buffers. Fixes #2914 --- src/pipewire/impl-port.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pipewire/impl-port.c b/src/pipewire/impl-port.c index 0021214f9..ef8fa068b 100644 --- a/src/pipewire/impl-port.c +++ b/src/pipewire/impl-port.c @@ -1473,6 +1473,12 @@ int pw_impl_port_set_param(struct pw_impl_port *port, uint32_t id, uint32_t flag port->added = false; } /* setting the format always destroys the negotiated buffers */ + if (port->direction == PW_DIRECTION_OUTPUT) { + struct pw_impl_link *l; + /* remove all buffers shared with an output port peer */ + spa_list_for_each(l, &port->links, output_link) + pw_impl_port_use_buffers(l->input, &l->rt.in_mix, 0, NULL, 0); + } pw_buffers_clear(&port->buffers); pw_buffers_clear(&port->mix_buffers);