alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Muni Sekhar <munisekharrms@gmail.com>,
	kernelnewbies <kernelnewbies@kernelnewbies.org>,
	linux-sound@vger.kernel.org,
	alsa-devel <alsa-devel@alsa-project.org>
Subject: Re: sound: ALSA PCM Timestamps
Date: Wed, 23 May 2018 08:54:15 -0500	[thread overview]
Message-ID: <e4baa571-35db-666c-0217-5d5a90b2249f@linux.intel.com> (raw)
In-Reply-To: <CAHhAz+g0tZ57xzS=FE71haZkrM4iXRS_HLe2pL0xic2y9t4CwA@mail.gmail.com>

On 5/23/18 8:00 AM, Muni Sekhar wrote:
> [ Please keep me in CC as I'm not subscribed to the list]
> 
> Hi All,
> 
> There are several time stamping functions in ALSA:
> 
> 
> snd_pcm_status_get_trigger_tstamp
> 
> snd_pcm_status_get_trigger_htstamp
> 
> snd_pcm_status_get_tstamp
> 
> snd_pcm_status_get_htstamp
> 
> snd_pcm_status_get_audio_htstamp
> 
> snd_pcm_status_get_driver_htstamp

the *_tstamp functions work with a 'struct timeval' which provides 
microsecond resolution.
The *_stamp functions work with a 'struct timespec' which provides 
nanosecond resolution.

The trigger_*tstamp returns the time when the stream started (typically 
when the DMA starts).
The get_tstamp returns the current timestamp measured with the regular 
timekeeping functions, which by subtracting the trigger timestamp 
provides the elapsed time since the start. You can specify if you want 
the REALTIME/MONOTONIC/MONOTONIC_RAW timestamp type, depending on your 
application.
The audio timestamp returns the current timestamp but measured using 
audio-specific counters. If the audio clocks are not aligned with the 
system time (e.g. if they use different oscillators or the audio clock 
source is external), there will be a drift between audio timestamps and 
system timestamp.


> 
> 
> 
> I would like to understand what points in time the resulting functions
> represent and what is the corresponding kernel mode callback for those
> API’s.
> 
> 
> I'd be really grateful if someone took the time to help me clearing my doubt.
> 
> 
> 

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

      reply	other threads:[~2018-05-23 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 13:00 sound: ALSA PCM Timestamps Muni Sekhar
2018-05-23 13:54 ` Pierre-Louis Bossart [this message]

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=e4baa571-35db-666c-0217-5d5a90b2249f@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=munisekharrms@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).