[alsa-devel] Timestamps using I/O Plugin

Johan Hellman johan.hellman at axis.com
Thu Jun 6 14:54:51 CEST 2013

>At Thu, 6 Jun 2013 09:01:12 +0200,
>Johan Hellman wrote:
>> 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!?
>AFAIK, there is nothing special in ioplug layer but it's a matter of
>ioplug plugin instance.  If the plugin sets
>SND_PCM_IOPLUG_FLAG_MONOTONIC bit to ioplug->flags, the ioplug layer
>uses the monotonic timestamp (via clock_gettime()) instead of
>gettimeofday().  So far, no plugins in alsa-plugins provide

Thanks for your reply, by enabling SND_PCM_IOPLUG_FLAG_MONOTONIC the ioplug 
would return a monotonic timestamp if requested by calling snd_pcm_htimestamp()
but it would be the current timestamp i.e. change every time you call ..htimestamp() 
and not be related to the last buffer update or anything(within ALSA) actually??. 
And there would be no timestamp information in the snd_pcm_status_t returned by 
snd_pcm_status() or am i missing something?  

What i found in the implementation for the ioplug layer(snd_pcm_ioplug_status) 
was that the status struct was memset to 0 but the tstamp is not set, so 0 
is returned as a monotonic timestamp.

Would a change similar to what i wrote in my previus post regarding adding the 
possibility for the plugin to override ..htimestamp() and the ioplug layer to 
update tstamp in the status struct using that function (if available)?


More information about the Alsa-devel mailing list