[alsa-devel] Question about the buffer length in the transfer callback of the PCM External Plugin

Clemens Ladisch clemens at ladisch.de
Sun Nov 6 12:26:43 CET 2016


Bach, Andrea wrote:
> What I tried is to copy the buffer I get in chunks of a 64 bytes into
> an intermediate buffer for processing and whenever I processed
> 64 bytes I copied the result to the output buffer .... but what to do
> with the remaining 40 bytes...

Leave them in the intermediate buffer, and handle them later when you've
got 24 more bytes.

> and what to return in the output buffer when the remaining bytes could
> not be processed??

Delay the entire chain by 64 bytes, i.e., insert 64 byte at the start of
the stream.  Then you always have too many bytes instead of too few
bytes, and those can be handled with the intermediate buffer.


Regards,
Clemens


More information about the Alsa-devel mailing list