From 088d741cda1ad5cac715d36615a28285ffb9b233 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 29 Nov 2023 15:06:05 +0100 Subject: [PATCH] stream: notify caller of partial set_param success When we get a Format update during a Format set_param, return > 0 to the caller so that it knows we modified the param to something else. This can be used to fixate or deny updates to Format params in the stream and have the adapter adapt to this. --- src/pipewire/stream.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 39e603b2d..d9fae3330 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -901,6 +901,7 @@ static int impl_port_set_param(void *object, { struct stream *impl = object; struct pw_stream *stream = &impl->this; + uint32_t user; int res; pw_log_debug("%p: port:%d.%d id:%d (%s) param:%p disconnecting:%d", impl, @@ -920,6 +921,7 @@ static int impl_port_set_param(void *object, switch (id) { case SPA_PARAM_Format: clear_buffers(stream); + user = impl->params[NODE_Format].user; break; case SPA_PARAM_Latency: parse_latency(stream, param); @@ -933,10 +935,17 @@ static int impl_port_set_param(void *object, if (stream->state == PW_STREAM_STATE_ERROR) return stream->error_res; + switch (id) { + case SPA_PARAM_Format: + if (user != impl->params[NODE_Format].user) + res++; + break; + } + emit_node_info(impl, false); emit_port_info(impl, false); - return 0; + return res; } static int impl_port_use_buffers(void *object,