Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Clemens Ladisch <clemens@ladisch.de>,
	Takashi Iwai <tiwai@suse.de>, Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Mark Brown <broonie@linaro.org>
Subject: Re: [PATCH] alsa-lib: Provide a CLOCK_MONOTONIC_RAW timestamp type
Date: Thu, 10 Jul 2014 10:10:56 -0500	[thread overview]
Message-ID: <53BEAD00.5050304@linux.intel.com> (raw)
In-Reply-To: <53BD9A92.6090806@ladisch.de>

On 7/9/14, 2:40 PM, Clemens Ladisch wrote:
> Takashi Iwai wrote:
>> Currently, the timestamp mode is set implicitly in alsa-lib pcm_hw.c:
>> - When kernel PCM protocol version is high enough, alsa-lib hw prefers
>>    the monotonic always (if available), then set pcm->monotonic = 1.
>> - Application can ask whether the current timestamp is monotonic or
>>    not via snd_pcm_hw_params_is_monotonic().
>> So, only adding the flag above doesn't suffice.  If we need to add a
>> new mode, the API has to be extended as well.
>>
>> But how?  The current API assumes that the monotonic mode was already
>> determined before hw_params.  We may add a set of new hw_params get
>> and set calls for tstamp mode while keeping the old API.  This would
>> be one option.  Another option would be to add a new PCM open flag
>> SND_PCM_TSTAMP_MONOTONIC_RAW, and snd_pcm_hw_params_is_monotonic_raw()
>> function.  The latter is easier (a simpler addition), while the former
>> is more extensible to newer formats in future.
>
> These timestamps cannot be handled by hardware drivers; they are always
> read by the ALSA framework, in software.  Furthermore, switching between
> MONOTONIC and MONOTONIC_RAW is possible at any time.  Therefore, the
> timestamp mode should be made a part of sw_params; just add a field
> named tstamp_mode ...

Humm... why would anyone switch modes at run time during 
playback/capture? I have seen timestamps being used mainly to track that 
playback/capture is happening as predicted, improve A/V sync or sleep 
for a predictable time with interrupts disabled (PulseAudio, Android, 
ChromeOS, etc). NTP adjustments are really adding noise more than 
information for those usages. I have yet to see a case where the use of 
those NTP adjustments would matter for userspace, and for now I really 
don't see the point of making this dynamically configurable as a 
software parameter. I would personally make this new mode the default.
-Pierre

  parent reply	other threads:[~2014-07-10 15:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 14:52 [PATCH] alsa-lib: Provide a CLOCK_MONOTONIC_RAW timestamp type Mark Brown
2014-07-09 13:38 ` Takashi Iwai
2014-07-09 19:40   ` Clemens Ladisch
2014-07-10 10:22     ` Takashi Iwai
2014-07-10 15:10     ` Pierre-Louis Bossart [this message]
2014-07-10 15:33       ` Takashi Iwai
2014-07-10 15:38         ` Pierre-Louis Bossart

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=53BEAD00.5050304@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=broonie@linaro.org \
    --cc=clemens@ladisch.de \
    --cc=daniel.thompson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox