mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -05:00
* really fix integer only resampler
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@316 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
7f3c92bad9
commit
5be9641ffe
1 changed files with 7 additions and 8 deletions
|
|
@ -333,7 +333,7 @@ static void trivial_run(struct pa_resampler *r, const struct pa_memchunk *in, st
|
|||
unsigned o_index;
|
||||
|
||||
/* The length of the new memory block rounded up */
|
||||
l = ((nframes * r->o_ss.rate + r->i_ss.rate - 1) / r->i_ss.rate) * fz;
|
||||
l = ((((nframes+1) * r->o_ss.rate) / r->i_ss.rate) + 1) * fz;
|
||||
|
||||
out->index = 0;
|
||||
out->memblock = pa_memblock_new(l, r->memblock_stat);
|
||||
|
|
@ -342,7 +342,6 @@ static void trivial_run(struct pa_resampler *r, const struct pa_memchunk *in, st
|
|||
unsigned j;
|
||||
|
||||
j = (i->o_counter * r->i_ss.rate / r->o_ss.rate);
|
||||
|
||||
j = j > i->i_counter ? j - i->i_counter : 0;
|
||||
|
||||
if (j >= nframes)
|
||||
|
|
@ -358,14 +357,14 @@ static void trivial_run(struct pa_resampler *r, const struct pa_memchunk *in, st
|
|||
out->length = o_index*fz;
|
||||
}
|
||||
|
||||
/* Normalize the output counter */
|
||||
while (i->o_counter >= r->o_ss.rate)
|
||||
i->o_counter -= r->o_ss.rate;
|
||||
|
||||
i->i_counter += nframes;
|
||||
|
||||
while (i->i_counter >= r->i_ss.rate)
|
||||
/* Normalize counters */
|
||||
while (i->i_counter >= r->i_ss.rate) {
|
||||
i->i_counter -= r->i_ss.rate;
|
||||
assert(i->o_counter >= r->o_ss.rate);
|
||||
i->o_counter -= r->o_ss.rate;
|
||||
}
|
||||
}
|
||||
|
||||
static void trivial_free(struct pa_resampler *r) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue