Commit 7c7fc2d4 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Fix PCM MMAP time-stamp mode

When MMAP time-stamp mode is given, it's supposed to update the time-stamp
only at period boundary.  However, it currently updates at each status call
so this is just useless.  The patch fixes this misbehavior.
Also it fixes the wrong check of tstamp_mode (don't use bit-and for enum).
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 7f6301cd
...@@ -148,8 +148,6 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substre ...@@ -148,8 +148,6 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(struct snd_pcm_substre
pos = substream->ops->pointer(substream); pos = substream->ops->pointer(substream);
if (pos == SNDRV_PCM_POS_XRUN) if (pos == SNDRV_PCM_POS_XRUN)
return pos; /* XRUN */ return pos; /* XRUN */
if (runtime->tstamp_mode & SNDRV_PCM_TSTAMP_MMAP)
getnstimeofday((struct timespec *)&runtime->status->tstamp);
#ifdef CONFIG_SND_DEBUG #ifdef CONFIG_SND_DEBUG
if (pos >= runtime->buffer_size) { if (pos >= runtime->buffer_size) {
snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size);
...@@ -189,6 +187,8 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs ...@@ -189,6 +187,8 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs
snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt; snd_pcm_uframes_t new_hw_ptr, hw_ptr_interrupt;
snd_pcm_sframes_t delta; snd_pcm_sframes_t delta;
if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_MMAP)
getnstimeofday((struct timespec *)&runtime->status->tstamp);
pos = snd_pcm_update_hw_ptr_pos(substream, runtime); pos = snd_pcm_update_hw_ptr_pos(substream, runtime);
if (pos == SNDRV_PCM_POS_XRUN) { if (pos == SNDRV_PCM_POS_XRUN) {
xrun(substream); xrun(substream);
......
...@@ -595,7 +595,7 @@ int snd_pcm_status(struct snd_pcm_substream *substream, ...@@ -595,7 +595,7 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
status->trigger_tstamp = runtime->trigger_tstamp; status->trigger_tstamp = runtime->trigger_tstamp;
if (snd_pcm_running(substream)) { if (snd_pcm_running(substream)) {
snd_pcm_update_hw_ptr(substream); snd_pcm_update_hw_ptr(substream);
if (runtime->tstamp_mode & SNDRV_PCM_TSTAMP_MMAP) if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_MMAP)
status->tstamp = runtime->status->tstamp; status->tstamp = runtime->status->tstamp;
else else
getnstimeofday(&status->tstamp); getnstimeofday(&status->tstamp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment