[alsa-devel] pcm_rate API question
Hello alsa devs,
There's an ongoing attempt to see if libsoxr-lsr can be used as a plug-in replacement for libsamplerate in pulseaudio and in alsa (libsoxr-lsr is designed with this usage in mind).
With pulseaudio, it seems to 'just work', but with alsa, it looks like there is a buffering problem. Progress reports for this are here:
http://blog.ivitera.com/pavel/linux-audio/pulseaudio-with-ld_preloading-libs...
http://blog.ivitera.com/pavel/linux-audio/simple-use-of-libsoxr-lsr-in-alsa-...
AFAICT, the problem with alsa relates to the use of this function in pcm_rate.h:
typedef struct snd_pcm_rate_ops { ... void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames, const int16_t *src, unsigned int src_frames);
Is there documentation available regarding the use of this function? For example, is the plugin obliged always to consume src_frames and generate dst_frames samples? If so, how is the plugin expected to comply (say, if it's not been given enough input to generate that amount of output)?
TIA, Rob
Rob Sykes wrote:
void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames, const int16_t *src, unsigned int src_frames);
is the plugin obliged always to consume src_frames and generate dst_frames samples?
Yes. src_frames and dst_frames are the period sizes of the respective devices; their values will never change, and they define the actual conversion ratio.
Regards, Clemens
participants (2)
-
Clemens Ladisch
-
Rob Sykes