ALSA: pcm: don't override timestamp unconditionally
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 6 Feb 2015 21:55:50 +0000 (15:55 -0600)
committerTakashi Iwai <tiwai@suse.de>
Mon, 9 Feb 2015 15:01:21 +0000 (16:01 +0100)
timestamp in RUNNING mode is already taken in update_hw_ptr routine,
getting a new timestamp introduces offset between hw_ptr, audio_tstamp
and system time

Add else condition to read timestamp as fallback and only when
enabled

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_native.c

index 932234d87927fc57bfb4640ecb036f8f6a5cda7f..4ecd35fbfe3f9c1eba7e82409ed8fd2c7bd6ba8e 100644 (file)
@@ -720,8 +720,11 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
                                runtime->status->audio_tstamp;
                        goto _tstamp_end;
                }
+       } else {
+               /* get tstamp only in fallback mode and only if enabled */
+               if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE)
+                       snd_pcm_gettime(runtime, &status->tstamp);
        }
-       snd_pcm_gettime(runtime, &status->tstamp);
  _tstamp_end:
        status->appl_ptr = runtime->control->appl_ptr;
        status->hw_ptr = runtime->status->hw_ptr;