mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-22 06:59:59 -05:00
small cleanups
This commit is contained in:
parent
28ae844de9
commit
6953642ed5
12 changed files with 32 additions and 24 deletions
|
|
@ -1000,6 +1000,16 @@ jack_engine_control_reset_rolling_usecs(struct jack_engine_control *ctrl)
|
|||
ctrl->rolling_interval = floor((JACK_ENGINE_ROLLING_INTERVAL * 1000.f) / ctrl->period_usecs);
|
||||
}
|
||||
|
||||
static inline uint64_t calc_computation(jack_nframes_t buffer_size)
|
||||
{
|
||||
if (buffer_size < 128)
|
||||
return 500;
|
||||
else if (buffer_size < 256)
|
||||
return 300;
|
||||
else
|
||||
return 100;
|
||||
}
|
||||
|
||||
static inline struct jack_engine_control *
|
||||
jack_engine_control_alloc(const char* name)
|
||||
{
|
||||
|
|
@ -1040,9 +1050,8 @@ jack_engine_control_alloc(const char* name)
|
|||
jack_engine_control_reset_rolling_usecs(ctrl);
|
||||
ctrl->CPU_load = 0.f;
|
||||
|
||||
ctrl->period = 0;
|
||||
ctrl->computation = 0;
|
||||
ctrl->constraint = 0;
|
||||
ctrl->period = ctrl->constraint = ctrl->period_usecs * 1000;
|
||||
ctrl->computation = calc_computation(ctrl->buffer_size) * 1000;
|
||||
|
||||
return ctrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -657,7 +657,7 @@ struct spa_format *pw_core_find_format(struct pw_core *core,
|
|||
} else if (in_state == PW_PORT_STATE_CONFIGURE && out_state == PW_PORT_STATE_CONFIGURE) {
|
||||
again:
|
||||
/* both ports need a format */
|
||||
pw_log_debug("core %p: finding best format", core);
|
||||
pw_log_debug("core %p: do enum input %d", core, iidx);
|
||||
if ((res = spa_node_port_enum_formats(input->node->node, input->direction, input->port_id,
|
||||
&filter, NULL, iidx)) < 0) {
|
||||
if (res == SPA_RESULT_ENUM_END && iidx != 0) {
|
||||
|
|
@ -665,7 +665,7 @@ struct spa_format *pw_core_find_format(struct pw_core *core,
|
|||
goto error;
|
||||
}
|
||||
}
|
||||
pw_log_debug("Try filter: %p", filter);
|
||||
pw_log_debug("enum output %d with filter: %p", oidx, filter);
|
||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||
spa_debug_format(filter);
|
||||
|
||||
|
|
|
|||
|
|
@ -1115,10 +1115,10 @@ struct pw_link *pw_link_new(struct pw_core *core,
|
|||
|
||||
spa_list_insert(core->link_list.prev, &this->link);
|
||||
|
||||
this->info.output_node_id = output ? output_node->global->id : -1;
|
||||
this->info.output_port_id = output ? output->port_id : -1;
|
||||
this->info.input_node_id = input ? input_node->global->id : -1;
|
||||
this->info.input_port_id = input ? input->port_id : -1;
|
||||
this->info.output_node_id = output_node->global->id;
|
||||
this->info.output_port_id = output->port_id;
|
||||
this->info.input_node_id = input_node->global->id;
|
||||
this->info.input_port_id = input->port_id;
|
||||
this->info.format = NULL;
|
||||
|
||||
spa_graph_port_init(&this->rt.out_port,
|
||||
|
|
@ -1135,11 +1135,10 @@ struct pw_link *pw_link_new(struct pw_core *core,
|
|||
this->rt.in_port.callbacks_data = this;
|
||||
this->rt.out_port.callbacks_data = this;
|
||||
|
||||
pw_loop_invoke(output_node->data_loop,
|
||||
do_add_link,
|
||||
/* nodes can be in different data loops so we do this twice */
|
||||
pw_loop_invoke(output_node->data_loop, do_add_link,
|
||||
SPA_ID_INVALID, sizeof(struct pw_port *), &output, false, this);
|
||||
pw_loop_invoke(input_node->data_loop,
|
||||
do_add_link,
|
||||
pw_loop_invoke(input_node->data_loop, do_add_link,
|
||||
SPA_ID_INVALID, sizeof(struct pw_port *), &input, false, this);
|
||||
|
||||
spa_hook_list_call(&output->listener_list, struct pw_port_events, link_added, this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue