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 SND_PCM_IOPLUG_FLAG_MONOTONIC yet, though.
Takashi
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)?
/JohanHellman