stream: don't emit param_changed from set_control

When we set a control, don't emit the param_changed event. We will
already receive the control_info as a result of the change.
Reserve the param_changed event for things that got changed by
something else.
This commit is contained in:
Wim Taymans 2022-05-09 15:35:27 +02:00
parent f24250da66
commit 4efb1a03cb

View file

@ -172,6 +172,7 @@ struct stream {
unsigned int driving:1; unsigned int driving:1;
unsigned int using_trigger:1; unsigned int using_trigger:1;
unsigned int trigger:1; unsigned int trigger:1;
int in_set_control;
}; };
static int get_param_index(uint32_t id) static int get_param_index(uint32_t id)
@ -543,7 +544,9 @@ static int impl_set_param(void *object, uint32_t id, uint32_t flags, const struc
if (id != SPA_PARAM_Props) if (id != SPA_PARAM_Props)
return -ENOTSUP; return -ENOTSUP;
if (impl->in_set_control == 0)
pw_stream_emit_param_changed(stream, id, param); pw_stream_emit_param_changed(stream, id, param);
return 0; return 0;
} }
@ -2117,7 +2120,9 @@ int pw_stream_set_control(struct pw_stream *stream, uint32_t id, uint32_t n_valu
va_end(varargs); va_end(varargs);
impl->in_set_control++;
pw_impl_node_set_param(impl->node, SPA_PARAM_Props, 0, pod); pw_impl_node_set_param(impl->node, SPA_PARAM_Props, 0, pod);
impl->in_set_control--;
return 0; return 0;
} }