diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-09-10 22:35:12 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-09-10 22:35:12 +0000 |
commit | 25123469d53e2ef555549984ea4e8b028c1632fb (patch) | |
tree | 4a1374c5e7ca11afff25d240b81809d23f791eb1 /polyp/resampler.c | |
parent | 0c99fb31826fba0ed4f904d04dd56f1df3663a3e (diff) |
add support for module search path as command line argument
protocol-native: move first data request into ack of stream creation
improve mainloop API: return the number of dispatched sources on iterate()
fix a resampling bug
introduce network latency measurement
WARNING: all these changes together may break some applications
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@189 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/resampler.c')
-rw-r--r-- | polyp/resampler.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/polyp/resampler.c b/polyp/resampler.c index b6b87607..173c0987 100644 --- a/polyp/resampler.c +++ b/polyp/resampler.c @@ -23,7 +23,6 @@ #include <config.h> #endif -#include <stdlib.h> #include <assert.h> #include <samplerate.h> @@ -31,6 +30,7 @@ #include "resampler.h" #include "sconv.h" #include "xmalloc.h" +#include "log.h" struct pa_resampler { struct pa_sample_spec i_ss, o_ss; @@ -120,6 +120,8 @@ void pa_resampler_run(struct pa_resampler *r, const struct pa_memchunk *in, stru /* How many input samples? */ ins = in->length/r->i_sz; +/* pa_log("%u / %u = %u\n", in->length, r->i_sz, ins); */ + /* How much space for output samples? */ if (r->src_state) ons = (ins*r->o_ss.rate/r->i_ss.rate)+1024; @@ -137,6 +139,9 @@ void pa_resampler_run(struct pa_resampler *r, const struct pa_memchunk *in, stru eff_ins = ins; eff_ons = ons; } + +/* pa_log("eff_ins = %u \n", eff_ins); */ + out->memblock = pa_memblock_new(out->length = (ons*r->o_sz), r->memblock_stat); out->index = 0; @@ -145,7 +150,9 @@ void pa_resampler_run(struct pa_resampler *r, const struct pa_memchunk *in, stru if (r->i_alloc < eff_ins) r->i_buf = pa_xrealloc(r->i_buf, sizeof(float) * (r->i_alloc = eff_ins)); assert(r->i_buf); - + +/* pa_log("eff_ins = %u \n", eff_ins); */ + r->to_float32_func(eff_ins, (uint8_t*) in->memblock->data+in->index, i_nchannels, r->i_buf); if (r->src_state) { @@ -179,6 +186,13 @@ void pa_resampler_run(struct pa_resampler *r, const struct pa_memchunk *in, stru } else cbuf = r->i_buf; - r->from_float32_func(eff_ons, cbuf, (uint8_t*)out->memblock->data+out->index, o_nchannels); + if (eff_ons) + r->from_float32_func(eff_ons, cbuf, (uint8_t*)out->memblock->data+out->index, o_nchannels); out->length = ons*r->o_sz; + + + if (!out->length) { + pa_memblock_unref(out->memblock); + out->memblock = NULL; + } } |