diff options
author | Glenn Kasten <gkasten@google.com> | 2013-08-22 15:11:48 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2013-09-03 11:11:10 -0700 |
commit | 810124041268e4f0b20d271ddc566d11ecb8575f (patch) | |
tree | e3e180d1e7f0f182c308e320fc4a56cba879ad67 /pcm.c | |
parent | 782bfda5e796cb46d0e7be0dc882ff686d5ad2a2 (diff) |
pcm_get_htimestamp can now use CLOCK_MONOTONIC
Previously the timebase was not documented. Now a new pcm_open flag
can be used to specify the clock. If flag PCM_MONOTONIC is specified,
then pcm_open uses SNDRV_PCM_IOCTL_TTSTAMP with parameter
SNDRV_PCM_TSTAMP_TYPE_MONOTONIC to request timestamps in CLOCK_MONOTONIC.
Change-Id: I40ce359cb38d686cbb2521fb0602a8a17ab4f925
Diffstat (limited to 'pcm.c')
-rw-r--r-- | pcm.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -719,6 +719,17 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, goto fail; } +#ifdef SNDRV_PCM_IOCTL_TTSTAMP + if (pcm->flags & PCM_MONOTONIC) { + int arg = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC; + rc = ioctl(pcm->fd, SNDRV_PCM_IOCTL_TTSTAMP, &arg); + if (rc < 0) { + oops(pcm, rc, "cannot set timestamp type"); + goto fail; + } + } +#endif + pcm->underruns = 0; return pcm; |