alsa: clamp threshold to configured max

This commit is contained in:
Wim Taymans 2018-06-25 17:07:59 +02:00
parent 75a18d5c7f
commit 8f41031933
2 changed files with 4 additions and 2 deletions

View file

@ -503,7 +503,8 @@ impl_node_port_use_buffers(struct spa_node *node,
spa_log_error(this->log, NAME " %p: need mapped memory", this); spa_log_error(this->log, NAME " %p: need mapped memory", this);
return -EINVAL; return -EINVAL;
} }
this->threshold = d[0].maxsize / this->frame_size; this->threshold = SPA_MIN(d[0].maxsize / this->frame_size,
this->props.max_latency);
} }
this->n_buffers = n_buffers; this->n_buffers = n_buffers;

View file

@ -525,7 +525,8 @@ impl_node_port_use_buffers(struct spa_node *node,
} }
spa_list_append(&this->free, &b->link); spa_list_append(&this->free, &b->link);
this->threshold = d[0].maxsize / this->frame_size; this->threshold = SPA_MIN(d[0].maxsize / this->frame_size,
this->props.max_latency);
} }
this->n_buffers = n_buffers; this->n_buffers = n_buffers;