From 8c12158687fc78091730d5456336b7efbf6f2250 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 11 Jan 2008 08:45:08 +0100 Subject: [ALSA] PCM interface - rename SNDRV_PCM_TSTAMP_MMAP to SNDRV_PCM_TSTAMP_ENABLE Change semantics for SNDRV_PCM_TSTAMP_MMAP. Doing timestamping only in the interrupt handler might cause that hw_ptr is not related to actual timestamp. With this change, grab timestamp at every hw_ptr update to have always valid timestamp + ring buffer position pair. With this change, SNDRV_PCM_TSTAMP_MMAP was renamed to SNDRV_PCM_TSTAMP_ENABLE. It's no regression (I think). Signed-off-by: Jaroslav Kysela --- sound/core/pcm_native.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sound/core/pcm_native.c') diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index e6e4aa87e57e..62449117ee14 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -580,9 +580,15 @@ int snd_pcm_status(struct snd_pcm_substream *substream, if (status->state == SNDRV_PCM_STATE_OPEN) goto _end; status->trigger_tstamp = runtime->trigger_tstamp; - if (snd_pcm_running(substream)) + if (snd_pcm_running(substream)) { snd_pcm_update_hw_ptr(substream); + if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { + status->tstamp = runtime->status->tstamp; + goto _tstamp_end; + } + } snd_pcm_gettime(runtime, &status->tstamp); + _tstamp_end: status->appl_ptr = runtime->control->appl_ptr; status->hw_ptr = runtime->status->hw_ptr; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { -- cgit v1.2.1