[pulseaudio-discuss] [PATCH 0/4] Add support for libsoxr resampler

Andrey Semashev andrey.semashev at gmail.com
Mon Nov 17 06:48:58 PST 2014


On Monday 17 November 2014 15:09:14 David Henningsson wrote:
> 
> Thanks for the tests. I think I misunderstood delay: I thought of delay
> as having 20 ms of zero samples in the beginning, but instead soxr will
> refuse to give you any samples out until you have fed it with 20 ms of
> samples in. Correct?

Yes, that's right. Speex also has the same behavior, if you call 
speex_resampler_skip_zeros() on the context. AFAIR, ffmpeg also works the same 
way.

> So then the variable delay would not result in artifacts, it will just
> be difficult to predict how many samples you'll get from the resampler.
> 
> I'm wondering if we then need to override pa_resampler_request to do
> something different for soxr? Is there a way you can ask soxr to do the
> equivalent of pa_resampler_request, i e, give you an answer to "how many
> samples do I need to input if I want x samples of output"?

Hmm, I don't think there is. I mentioned soxr_delay() earlier, but it works 
post-factum (i.e. returns the current delay). I didn't see any other delay-
related API.

You could probably implement a repacketizer in the resampler to guarantee that 
the frame size is constant, and then use soxr_delay() as the approximation, 
but even then it probably wouldn't work for a few frames in the beginning, 
while the resampler is filling.



More information about the pulseaudio-discuss mailing list