[alsa-devel] Timestamps using I/O Plugin
johan.hellman at axis.com
Thu Jun 6 09:01:12 CEST 2013
After spending more time investigating how I would set monotonic timestamps from a new I/O plugin so that the app using ALSA lib could synchronize different audio streams I cant find that its possible!?
Can someone please confirm that it is not possible to set monotonic timestamps using the I/O plugin SDK!?
The new plugin would know the relationship between audio streams timestamp information and the systems monotonic clock. If it was possible to override the snd_pcm_htimestamp() then the timestamp could be fetched from the I/O plugin, and snd_pcm_status()->snd_pcm_ioplug_status() could call that overridden function to fill in tstamp into the status object. If not implemented in the I/O plugin call snd_pcm_generic_real_htimestamp() as today. Would this be an acceptable way forward?
From: alsa-devel-bounces at alsa-project.org [alsa-devel-bounces at alsa-project.org] On Behalf Of Johan Hellman [johanhn at axis.com]
Sent: Friday, May 31, 2013 11:22 AM
To: alsa-devel at alsa-project.org
Subject: [alsa-devel] Timestamps using I/O Plugin
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?
Alsa-devel mailing list
Alsa-devel at alsa-project.org
More information about the Alsa-devel