I have a program which reads
4096 frames (16384 bytes)
16bit LE
48000 Hz
PCM
into a 16384 bytes large buffer per "read" from a kernel module (= read from ALSA's ring-buffer).
After each "read" I have to downsample the 48 kHz to 44.1 kHz and the output must be smaller/equal 4096 frames (streaming to Apple's Airport Express).
It already works, but the output sounds "too fast" and is "flickering" (I think due to lost frames in the "read", described below), then stops sometimes (I think "too fast" causes "wait for data").
For the resampling I use src_process from libsamplerate (aka Secret Rabbit Code):
int src_process (SRC_STATE *state, SRC_DATA *data) ;
with following parameters:
data_in : A pointer to the input data samples.
input_frames : 4096
data_out : A pointer to the output data samples.
output_frames : 4096
src_ratio : 44100 / 48000 -> 0,91875
My kernel module tells me when I missed some frames in ALSA's ring-buffer inside and this happens.
I'am missing about 100 frames / "read".
Maybe someone understands the problem and can say something like "4096 frames-buffer is too small" or something else.
Meanwhile I will re-check my code.