summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-11-21 15:22:59 +0000
committerLennart Poettering <lennart@poettering.net>2004-11-21 15:22:59 +0000
commit92f73a741f7d439263857ea5c438a612ce24b03d (patch)
treea1e02ee8b5d68c60c34c606a31736bd2d1bd2d23
parentf2b11dbef8bb638ff57baf3225864ed732164fe7 (diff)
* fix the trivial resampler
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@300 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--doc/todo2
-rw-r--r--polyp/resampler.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/doc/todo b/doc/todo
index c5f7dbba..d5514504 100644
--- a/doc/todo
+++ b/doc/todo
@@ -4,9 +4,9 @@
- make most buffer sizes dependant on the sample type
- limit all resources
- commenting
-- polish for starting polypaudio as root/system-wide instance
** later ***
+- polish for starting polypaudio as root/system-wide instance
- per-channel volume
- improve module-oss-mmap latency measurement
- module-tunnel: improve latency calculation
diff --git a/polyp/resampler.c b/polyp/resampler.c
index 6cf51dab..dbd748f7 100644
--- a/polyp/resampler.c
+++ b/polyp/resampler.c
@@ -310,7 +310,7 @@ fail:
static void trivial_run(struct pa_resampler *r, const struct pa_memchunk *in, struct pa_memchunk *out) {
size_t fz;
- unsigned nsamples;
+ unsigned nframes;
struct impl_trivial *i;
assert(r && in && out && r->impl_data);
i = r->impl_data;
@@ -318,22 +318,22 @@ static void trivial_run(struct pa_resampler *r, const struct pa_memchunk *in, st
fz = r->i_fz;
assert(fz == r->o_fz);
- nsamples = in->length/fz;
+ nframes = in->length/fz;
if (r->i_ss.rate == r->o_ss.rate) {
/* In case there's no diefference in sample types, do nothing */
*out = *in;
- pa_memblock_ref(in->memblock);
+ pa_memblock_ref(out->memblock);
- i->o_counter += nsamples;
+ i->o_counter += nframes;
} else {
/* Do real resampling */
size_t l;
unsigned o_index;
/* The length of the new memory block rounded up */
- l = ((nsamples * r->o_ss.rate + r->i_ss.rate - 1) / r->i_ss.rate) * fz;
+ l = ((nframes * r->o_ss.rate + r->i_ss.rate - 1) / r->i_ss.rate) * fz;
out->index = 0;
out->memblock = pa_memblock_new(l, r->memblock_stat);
@@ -345,13 +345,13 @@ static void trivial_run(struct pa_resampler *r, const struct pa_memchunk *in, st
assert(j >= i->i_counter);
j = j - i->i_counter;
- if (j >= nsamples)
+ if (j >= nframes)
break;
assert(o_index*fz < out->memblock->length);
memcpy((uint8_t*) out->memblock->data + fz*o_index,
- (uint8_t*) in->memblock->data + fz*j, fz);
+ (uint8_t*) in->memblock->data + in->index + fz*j, fz);
}
@@ -362,7 +362,7 @@ static void trivial_run(struct pa_resampler *r, const struct pa_memchunk *in, st
while (i->o_counter >= r->o_ss.rate)
i->o_counter -= r->o_ss.rate;
- i->i_counter += nsamples;
+ i->i_counter += nframes;
while (i->i_counter >= r->i_ss.rate)
i->i_counter -= r->i_ss.rate;