All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Dylan Reid <dgreid@chromium.org>
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: [PATCH v2] ALSA: hda/ca0132 - Update latency based on DSP state.
Date: Fri, 05 Apr 2013 12:20:26 -0500	[thread overview]
Message-ID: <515F07DA.1040608@linux.intel.com> (raw)
In-Reply-To: <CAEUnVG7iLokj+biNXfrppp_z_toDCNPww-Y4QJXU3voC2a-FHg@mail.gmail.com>


> Thanks for the explanation Pierre, but I'm still a little confused.
>
> Does the timestamp represent the time the last sample was put in the
> buffer or the time the last sample was rendered to the bus?
>
> Is the "current time" meant to be the timestamp that the next sample
> sent will be rendered?  (timestamp + delay)

When you query with snd_pcm_status(), you get all sort of information, 
including 2 timestamps. The 'regular' timestamp is just the system time 
(tsc) and the 'audio' timestamp is the time as reported by the audio 
hardware. This can be inferred by reading sample counters (# of samples 
pushed on the serial link) or wallclock counters, the wallclock is 
essentially identical but gives you a higher degree of precision. The 
audio time really needs to be taken at the last possible stage, not when 
you write into a buffer.
The two timestamps can be used to find out what the drift is between the 
two time references (eg in PulseAudio)
In other words, if you add the codec delay, it's fine but it needs to be 
accounted for in a symmetrical manner, otherwise the audio timestamp and 
the delay will be off by a fixed amount. Correcting the wallclock value 
and substracting the codec delay in azx_get_wallclk() would realign 
accounting methods.
-Pierre

  reply	other threads:[~2013-04-05 17:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04 20:55 [PATCH v2] ALSA: hda/ca0132 - Update latency based on DSP state Dylan Reid
2013-04-05  5:40 ` Takashi Iwai
2013-04-05 15:01   ` Pierre-Louis Bossart
2013-04-05 15:22     ` Takashi Iwai
2013-04-05 16:28       ` Pierre-Louis Bossart
2013-04-05 17:01         ` Dylan Reid
2013-04-05 17:20           ` Pierre-Louis Bossart [this message]
2013-04-05 18:13             ` Dylan Reid
2013-04-05 21:24               ` Pierre-Louis Bossart
2013-04-05 21:44                 ` Dylan Reid

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=515F07DA.1040608@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=dgreid@chromium.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.