impl-port: init some stuff earlier

Initialize the mix_hooks, port_map and latency earlier, before we call
pw_impl_port_set_mix() and update_info, that could potentially expect
this to be initialized.
This commit is contained in:
Wim Taymans 2025-09-18 15:21:50 +02:00
parent c296c52cae
commit 1717ff336e

View file

@ -800,6 +800,12 @@ struct pw_impl_port *pw_context_create_port(
spa_list_init(&this->control_list[1]);
spa_hook_list_init(&this->listener_list);
spa_hook_list_init(&impl->mix_hooks);
pw_map_init(&this->mix_port_map, 64, 64);
this->latency[SPA_DIRECTION_INPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_INPUT);
this->latency[SPA_DIRECTION_OUTPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_OUTPUT);
if (this->direction == PW_DIRECTION_INPUT)
mix_methods = &schedule_mix_node;
@ -810,15 +816,9 @@ struct pw_impl_port *pw_context_create_port(
SPA_TYPE_INTERFACE_Node,
SPA_VERSION_NODE,
mix_methods, impl);
spa_hook_list_init(&impl->mix_hooks);
pw_impl_port_set_mix(this, NULL, 0);
pw_map_init(&this->mix_port_map, 64, 64);
this->latency[SPA_DIRECTION_INPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_INPUT);
this->latency[SPA_DIRECTION_OUTPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_OUTPUT);
if (info)
update_info(this, info);