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.
This commit is contained in:
Wim Taymans 2023-11-29 15:06:05 +01:00
parent b9e5dde4ac
commit 088d741cda

View file

@ -901,6 +901,7 @@ static int impl_port_set_param(void *object,
{ {
struct stream *impl = object; struct stream *impl = object;
struct pw_stream *stream = &impl->this; struct pw_stream *stream = &impl->this;
uint32_t user;
int res; int res;
pw_log_debug("%p: port:%d.%d id:%d (%s) param:%p disconnecting:%d", impl, 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) { switch (id) {
case SPA_PARAM_Format: case SPA_PARAM_Format:
clear_buffers(stream); clear_buffers(stream);
user = impl->params[NODE_Format].user;
break; break;
case SPA_PARAM_Latency: case SPA_PARAM_Latency:
parse_latency(stream, param); parse_latency(stream, param);
@ -933,10 +935,17 @@ static int impl_port_set_param(void *object,
if (stream->state == PW_STREAM_STATE_ERROR) if (stream->state == PW_STREAM_STATE_ERROR)
return stream->error_res; 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_node_info(impl, false);
emit_port_info(impl, false); emit_port_info(impl, false);
return 0; return res;
} }
static int impl_port_use_buffers(void *object, static int impl_port_use_buffers(void *object,