mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-01 22:58:47 -04:00
resampler: round up when estimating input/output sizes
This commit is contained in:
parent
9e21182e01
commit
fecd0dc801
1 changed files with 6 additions and 2 deletions
|
|
@ -347,13 +347,17 @@ void pa_resampler_set_output_rate(pa_resampler *r, uint32_t rate) {
|
|||
size_t pa_resampler_request(pa_resampler *r, size_t out_length) {
|
||||
pa_assert(r);
|
||||
|
||||
return (((out_length / r->o_fz)*r->i_ss.rate)/r->o_ss.rate) * r->i_fz;
|
||||
/* Let's round up here */
|
||||
|
||||
return (((((out_length + r->o_fz-1) / r->o_fz) * r->i_ss.rate) + r->o_ss.rate-1) / r->o_ss.rate) * r->i_fz;
|
||||
}
|
||||
|
||||
size_t pa_resampler_result(pa_resampler *r, size_t in_length) {
|
||||
pa_assert(r);
|
||||
|
||||
return (((in_length / r->i_fz)*r->o_ss.rate)/r->i_ss.rate) * r->o_fz;
|
||||
/* Let's round up here */
|
||||
|
||||
return (((((in_length + r->i_fz-1) / r->i_fz) * r->o_ss.rate) + r->i_ss.rate-1) / r->i_ss.rate) * r->o_fz;
|
||||
}
|
||||
|
||||
size_t pa_resampler_max_block_size(pa_resampler *r) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue