[alsa-devel] Issue with RME HDSPe AIO latency
jamesm at filmlight.ltd.uk
Mon Apr 30 18:03:19 CEST 2012
I'm using the RME hdspm kernel module with a Hammerfall HDSPe AIO card.
I'm on RHEL 5.5, with alsa 1.0.17, kernel 2.6.18-194.11.4.
I have backported the latest alsa hdspm code to this kernel, as there
were a number of bugs in the one that ships with the 2.6.18-194 kernel.
I've also implemented support for copy() and silence() functions so that
the hdspm driver can be used with applications via the RDWR interface
instead of just MMAP (ie it just works with aplay without using plughw
The latest hdspm driver code from alsa and kernel.org indicates that
the HDSPe AIO card has a fixed buffer size of 16384. I've chosen a
period size of 1024, which gives me 16 periods.
The issue I have is that whenever I play audio through the hdspm
driver, the delay between the hw pointer and sw pointer is always close
to the maximum buffer size (approx 16000). This leaves me with a large
delay between writing data into the PCM and it coming out of the card.
I'd like this to be between 1024 and 2048, I could probably crank the
period down further to 512.
My application sets the start_threshold to 0 and avail_min to one
period (1024). It then runs a thread, constantly writing data to the PCM
(silence or real data).
Does anyone have any suggestions as to why the hdspm driver hw pointer
is not following the application pointer more closely?
Is it due to the number of periods? Unfortunately I can't change that
as the AIO buffer size is fixed.
Here are my pcm hwparams, swparams and status from /proc/asound when my
app is running:
$ cat /proc/asound/card0/pcm0p/info
id: RME AIO
name: RME AIO
subname: subdevice #0
$ cat /proc/asound/card0/pcm0p/sub0/hw_params
rate: 48000 (48000/1)
$ cat /proc/asound/card0/pcm0p/sub0/sw_params
$ cat /proc/asound/card0/pcm0p/sub0/status
tstamp : 1335801526.687332000
delay : 15664
avail : 720
avail_max : 1056
hw_ptr : 74911440
appl_ptr : 74927104
More information about the Alsa-devel