[alsa-devel] Timestamps using I/O Plugin

Johan Hellman johan.hellman at axis.com
Fri May 31 11:22:59 CEST 2013


I was excited when I found that it was possible to write user space drivers for ALSA, but I can't get my head around how timestamping works when using a I/O plugin instance.

I better start explaining what we want to do.
Basically we just want to transfer raw audio between the HOST running ALSA and one or more small(tiny) network connected MCUs with audio codecs. We need to synchronize the different network sources with the local HW sources (on the ALSA HOST).

Starting looking into how timestamps is handled by ALSA  I could not find how it was possible to set the timestamp, there seems to be some differences compared to using a normal kernel driver!?
If I understand it correctly timestamp can be obtained by calling snd_pcm_status() but the ioplugs implementation of the .status() newer fills in the ->tstamp only the ->trigger_tstamp, so how can I set the timestamp of the data my plugin delivers to ALSA? Additionally snd_pcm_htimestamp() only seams to return the current monotonic clock at the point the function was called for an ioplug instance!?

I saw that there are plugins for pulseaudio and jack doing what we whant to achieve but because of the footprint of the MCU we can't use PA/Jack  on these MCU:s. But how have they solved this issue or isn't it  an issue for their usecase?
/JohanHellman






More information about the Alsa-devel mailing list