change usage of pw_loop_invoke

This commit is contained in:
Frank Krick 2025-08-19 12:00:21 -04:00
parent 3ccd3b15a0
commit b180438203

View file

@ -1260,8 +1260,16 @@ static int apply_props(struct spa_loop *loop, bool async, uint32_t seq, const vo
size_t size, void *user_data) size_t size, void *user_data)
{ {
const struct impl *impl = user_data; const struct impl *impl = user_data;
const struct spa_pod *props = data; const struct spa_pod *pod = data;
spa_filter_graph_set_props(impl->graph, SPA_DIRECTION_OUTPUT, props);
struct spa_pod_control *pod_control;
SPA_POD_SEQUENCE_FOREACH((struct spa_pod_sequence *)pod, pod_control) {
if (pod_control->type == SPA_CONTROL_Properties) {
spa_filter_graph_set_props(impl->graph, SPA_DIRECTION_OUTPUT,
&pod_control->value);
}
}
return 0; return 0;
} }
@ -1271,26 +1279,19 @@ static void control_process(void *d)
struct pw_buffer *control = pw_stream_dequeue_buffer(impl->control); struct pw_buffer *control = pw_stream_dequeue_buffer(impl->control);
if (control == NULL) if (control == NULL)
goto done; goto done;
if (control->buffer->n_datas > 0) { if (control->buffer->n_datas > 0) {
struct spa_pod *pod = spa_pod_from_data( struct spa_pod *pod = spa_pod_from_data(
control->buffer->datas[0].data, control->buffer->datas[0].data,
control->buffer->datas[0].maxsize, control->buffer->datas[0].maxsize,
control->buffer->datas[0].chunk->offset, control->buffer->datas[0].chunk->offset,
control->buffer->datas[0].chunk->size); control->buffer->datas[0].chunk->size);
if (spa_pod_is_sequence(pod)) { if (spa_pod_is_sequence(pod)) {
struct spa_pod_sequence *sequence = (struct spa_pod_sequence *)pod; struct pw_loop *loop = pw_context_get_main_loop(impl->context);
pw_loop_invoke(loop, apply_props, 0, pod, SPA_POD_SIZE(pod),
struct spa_pod_control *pod_control; false, impl);
SPA_POD_SEQUENCE_FOREACH(sequence, pod_control) { }
if (pod_control->type == SPA_CONTROL_Properties) {
struct pw_loop *loop = pw_context_get_main_loop(impl->context);
pw_loop_invoke(loop, apply_props, 0, &pod_control->value,
SPA_POD_SIZE(&pod_control->value), false, impl);
}
}
}
} }
done: done: