snd_pcm_extplug_callback_t transfer callback and buffering

Arsen Arsenović arsen at aarsen.me
Mon Jan 18 21:02:50 CET 2021


Hello!

I am writing an external noise cancellation plugin for ALSA, based on rnnoise,
but I've hit a bit of a roadblock: rnnoise processes chunks of 480 floats at a
time and does no buffering, but alsa expects the transfer callback to take all
the data from the input and put it onto the output, with no way to signal that
any buffering is or should be happening.

I have tried to return a multiple of 480 from the transfer callback and keep a
buffer with the leftover data, to be prepended to the next payload, but it
looks like ALSA will, when a plugin returns too little data, just send back the
same non-processed data in a new call, which breaks this idea.

Any way I can work around these limitations?

Another solution could be for external plugins to report the amount they
consumed and output, rather than a single number for both, but I am not aware
of how to do that.

-- 
Arsen Arsenović
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20210118/396cedd3/attachment-0001.sig>


More information about the Alsa-devel mailing list