mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
jack: Use latency of sink as buffer size
This commit is contained in:
parent
ce6b75cf63
commit
630dbd2c90
2 changed files with 27 additions and 4 deletions
|
|
@ -1010,6 +1010,15 @@ static inline uint64_t calc_computation(jack_nframes_t buffer_size)
|
|||
return 100;
|
||||
}
|
||||
|
||||
static inline void
|
||||
jack_engine_control_set_buffer_size(struct jack_engine_control *ctrl, jack_nframes_t buffer_size)
|
||||
{
|
||||
ctrl->buffer_size = buffer_size;
|
||||
ctrl->period_usecs = 1000000.f / ctrl->sample_rate * ctrl->buffer_size;
|
||||
ctrl->period = ctrl->constraint = ctrl->period_usecs * 1000;
|
||||
ctrl->computation = calc_computation(ctrl->buffer_size) * 1000;
|
||||
}
|
||||
|
||||
static inline struct jack_engine_control *
|
||||
jack_engine_control_alloc(const char* name)
|
||||
{
|
||||
|
|
@ -1024,11 +1033,9 @@ jack_engine_control_alloc(const char* name)
|
|||
ctrl = (struct jack_engine_control *)jack_shm_addr(&info);
|
||||
ctrl->info = info;
|
||||
|
||||
ctrl->buffer_size = 128;
|
||||
ctrl->sample_rate = 48000;
|
||||
ctrl->sync_mode = false;
|
||||
ctrl->temporary = false;
|
||||
ctrl->period_usecs = 1000000.f / ctrl->sample_rate * ctrl->buffer_size;
|
||||
ctrl->timeout_usecs = 0;
|
||||
ctrl->max_delayed_usecs = 0.f;
|
||||
ctrl->xrun_delayed_usecs = 0.f;
|
||||
|
|
@ -1050,8 +1057,7 @@ jack_engine_control_alloc(const char* name)
|
|||
jack_engine_control_reset_rolling_usecs(ctrl);
|
||||
ctrl->CPU_load = 0.f;
|
||||
|
||||
ctrl->period = ctrl->constraint = ctrl->period_usecs * 1000;
|
||||
ctrl->computation = calc_computation(ctrl->buffer_size) * 1000;
|
||||
jack_engine_control_set_buffer_size(ctrl, 128);
|
||||
|
||||
return ctrl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue