[pulseaudio-discuss] [PATCH v3 3/3] resampler: Add support for resamplers that consume less data than asked.

Tanu Kaskinen tanu.kaskinen at digia.com
Fri May 11 01:53:16 PDT 2012


On Fri, 2012-05-11 at 15:49 +0800, Wang Xingchao wrote:
> 2012/5/10 Tanu Kaskinen <tanuk at iki.fi>:
> > libsamplerate_resample() assumed that src_process() would
> > always consume the whole input buffer. That was an invalid
> > assumption leading to crashes.
> >
> > This patch adds a leftover memchunk for storing any
> > non-consumed input. When pa_resampler_run() is called next
> > time, the leftover is prepended to the new input.
> >
> > Changes in v3:
> >  - Make the calculations in pa_resampler_result() and
> >   pa_resampler_max_block_size() more readable and more
> >   correct.
> >  - Rework the leftover storing: instead of using a dedicated
> >   buffer for it, store it in the beginning of remap_buf.
> >   This can avoid some memory copying. (The idea was
> >   suggested by Wang Xingchao.)
> 
> I read through the patch and your change looks better than my initial idea.  :)
> btw, can you reproduce the Bug 100% then i can do some test for your patch...

Thanks, but I don't know how the bug can be reproduced at all. I've
tried running the libsamplerate resampler with different kinds of
strange sample rates, but that didn't trigger the bug condition. I've
tested the leftover functionality only by adding a hack to
libsamplerate_resample() that substracts 1 from data.input_frames. That
ensures that src_process() never processes the last frame. The audio has
been smooth when doing that.

-- 
Tanu



More information about the pulseaudio-discuss mailing list