[alsa-devel] Timestamps using I/O Plugin
Johan Hellman
johan.hellman at axis.com
Mon Jun 17 09:14:37 CEST 2013
On Thu, 2013-06-06 at 14:54 +0200, Johan Hellman wrote:
> >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
snd_pcm_ioplug_status() is missing a call to
gettimestamp(&status->tstamp, pcm->monotonic); compared to other
overridden _status functions (dshare/dmix etc..).
With gettimestamp() added to the ioplug, calls to snd_pcm_status() would
fill in a timestamp and SNDRV_PCM_TSTAMP_TYPE_MONOTONIC would determine
if the timestamp returned would be monotonic or not.
This would not fix my problem. If a kernel drivers has
SNDRV_PCM_TSTAMP_ENABLE set then ALSA lets the driver return the
timestamp, a ioplugin does not have this possibility.
Any comments or suggestions on how to proceed?
/JohanHellman
More information about the Alsa-devel
mailing list