Here's a fix for https://bugs.freedesktop.org/show_bug.cgi?id=47156 Changes in v3: - More readable calculations, as suggested by David. Also fixed a couple of bugs in those calculations. - Rework the leftover storing, as suggested by Wang Xingchao: instead of using a dedicated buffer for it, store the leftover data in the beginning of remap_buf. This can avoid some memory copying. - Use a generic save_leftover() function instead of doing the leftover copying in the resampler implementor code. - Use the leftover logic also with the speex and ffmpeg resamplers. Changes in v2: - Fixed bugs. - Better testing: I forced the resampler to always leave the last frame unprocessed. That uncovered one bug, but now the playback is smooth. - Sensible buffer names. Tanu Kaskinen (3): resampler: Use pa_xnew0() to avoid manual zeroing. resampler: Use more descriptive buffer names. resampler: Add support for resamplers that consume less data than asked. src/pulsecore/resampler.c | 357 ++++++++++++++++++++++++++++----------------- 1 file changed, 222 insertions(+), 135 deletions(-) -- 1.7.10