Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* timestamps
@ 2010-04-21 11:00 Jonas Holmberg
  2010-05-04 18:22 ` timestamps Kai Vehmanen
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Holmberg @ 2010-04-21 11:00 UTC (permalink / raw)
  To: alsa-devel

How can I get the CLOCK_MONOTONIC timestamp for the first sample in the
data I get from snd_pcm_readi()?

/Jonas

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: timestamps
  2010-04-21 11:00 timestamps Jonas Holmberg
@ 2010-05-04 18:22 ` Kai Vehmanen
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Vehmanen @ 2010-05-04 18:22 UTC (permalink / raw)
  To: Jonas Holmberg; +Cc: alsa-devel

Hi,

On Wed, 21 Apr 2010, Jonas Holmberg wrote:

> How can I get the CLOCK_MONOTONIC timestamp for the first sample in the
> data I get from snd_pcm_readi()?

before reading the data, take the current timestamp (with clock_gettime) 
and subtract snd_pcm_delay() for the stream (see the API docs for 
snd_pcm_delay() for more details).

The accuracy of the returned value depends on the driver/hw's ability to 
report accurate delay values.

PS Alternate strategy is to use SND_PCM_TSTAMP_MMAP mode, in which
    you can query (with snd_pcm_htimestamp()) the timestamp of
    last period elapsed event. See the alsa-lib PCM API docs for
    details. With certain drivers/hw, this is the only way to get
    accurate estimates for delay.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-04 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-21 11:00 timestamps Jonas Holmberg
2010-05-04 18:22 ` timestamps Kai Vehmanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox