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

Tanu Kaskinen tanu.kaskinen at digia.com
Wed May 2 00:53:34 PDT 2012

On Wed, 2012-05-02 at 15:34 +0800, Wang Xingchao wrote:
> 2012/5/2 Tanu Kaskinen <tanuk at iki.fi>:
> > On Wed, 2012-05-02 at 06:08 +0300, Tanu Kaskinen wrote:
> >> I don't understand what you mean. How would you achieve only one copy?
> >>
> >> If you mean that the leftover buffer should be copied to the input
> >> buffer, thus avoiding copying the input buffer, that doesn't work. The
> >> input buffer doesn't have any spare room for the leftover data.
> >
> > I now realized that copying the leftover data twice (once when storing
> > it and once in add_leftover()) could be reduced to only one copy by
> > using the same buffer in those two phases. The leftover size tends to be
> > small, so the amount of work that is saved is also small, but I think it
> > wouldn't make the code significantly more complex, so maybe I should
> > implement that.
> Sorry for confuse first.
> Not exactly. If there's left_over bytes, we could put them at the
> start of r->buf2, and change the "dst" of do_remap for next memchunk.
> Is that okay for you?

Ah, I see how that can save copying the input if remapping has to be
done. When remapping is not needed, then the copying will still be
needed, but there's one less memblock per resampler anyway. I'll do what
you suggest.


More information about the pulseaudio-discuss mailing list