All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Lindholm <holindho@cs.helsinki.fi>
To: Takashi Iwai <tiwai@suse.de>
Cc: Claudio Matsuoka <cmatsuoka@gmail.com>, alsa-devel@alsa-project.org
Subject: Re: Latency and timestamps
Date: Wed, 21 Nov 2007 15:26:05 +0200	[thread overview]
Message-ID: <474431ED.4060903@cs.helsinki.fi> (raw)
In-Reply-To: <s5h4pffj2j3.wl%tiwai@suse.de>

Takashi Iwai kirjoitti:
> At Mon, 19 Nov 2007 22:46:31 -0200,
> Claudio Matsuoka wrote:
>> Hi,
>>
>> I'm adding latency control to an application and didn't find much
>> documentation about the pcm status functions aside from a very brief
>> description and the latency.c example. What exactly are the "trigger
>> timestamp" and "now timestamp" returned by
>> snd_pcm_status_get_trigger_tstamp() and snd_pcm_status_get_tstamp()?
> 
> The trigger_tstamp is the time-stamp at the last time the PCM status
> change occured.  For example, when the PCM is really triggered to
> start, or stopped, or XRUN, etc.  It won't be changed as long as the 
> PCM status is kept.
> 
> OTOH, the tstamp is the current timestamp (now).  But, this value has
> a slightly different meaning when tstamp_mode is set to
> SND_PCM_TSTAMP_MMAP.  Then it keeps the timestamp of the last period
> update time instead of the now.

I looked at the code and I'm not sure I understand the above "last 
period update time" correctly. I'd like to think that MMAP timestamp is 
updated by the driver interrupt handler when a new period arrives _and 
only there_, but the code seems somewhat different:
- the timestamp is generated in snd_pcm_update_hw_ptr_pos
- snd_pcm_update_hw_ptr_pos is called by snd_pcm_update_hw_ptr_interrupt
- the driver interrupt updates the timestamp in snd_pcm_period_elapsed
BUT if the user calls snd_pcm_status
- snd_pcm_status calls snd_pcm_update_hw_ptr
- snd_pcm_update_hw_ptr calls snd_pcm_update_hw_ptr_pos
and therefore it seems that the timestamp is updated when calling 
snd_pcm_status also, effectively making the timestamp a "now" timestamp 
anyway.

-- Heikki Lindholm

  parent reply	other threads:[~2007-11-21 13:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-20  0:46 Latency and timestamps Claudio Matsuoka
2007-11-21 10:50 ` Takashi Iwai
2007-11-21 11:33   ` Heikki Lindholm
2007-11-21 11:02     ` Takashi Iwai
2007-11-21 13:26   ` Heikki Lindholm [this message]
2007-11-21 13:11     ` Takashi Iwai
2007-11-21 14:25       ` Takashi Iwai

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=474431ED.4060903@cs.helsinki.fi \
    --to=holindho@cs.helsinki.fi \
    --cc=alsa-devel@alsa-project.org \
    --cc=cmatsuoka@gmail.com \
    --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.