All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lennart Poettering <mznyfn@0pointer.de>
To: ALSA Development Mailing List <alsa-devel@alsa-project.org>
Subject: Rationale behind snd_pcm_htimestamp()
Date: Mon, 16 Feb 2009 03:35:09 +0100	[thread overview]
Message-ID: <20090216023509.GA16494@tango.0pointer.de> (raw)

Heya!

I am interested to query the current delay and the current avail
atomically together with the timestamp when they were current.

Apparantly there is now a function that can get the former two
atomically (snd_pcm_avail_delay()) and another one that gets the latter
two atomically (snd_pcm_htimestamp()). _avail_delay() seems to sync
the hw index data, _htimestamp() apparently not. Hence I had assume
that first calling _avail_delay() and then _htimestamp() one after the
other without any further access would return the same avail
value. Turns out, my test results on an USB card show that this
assumption is not true.

An alternative way seemed to be to go via the snd_pcm_status
structure. However querying that seems not to sync the hw index
data. Hmm... so let's call snd_pcm_hwsync() right before querying the
struct -- as it turns out however, that function is now deprecated. So
which function should I call? The doxygen comments of _hwsync() kind
of suggest in a way to call snd_pcm_avail_update(), whose doxygen
comments however declare that it does in fact *not* sync the hw state
either, but suggest to use snd_pcm_avail() for that.

Ok, so I am now tempted to first call snd_pcm_avail() and then
snd_pcm_status() and have all three values atomically. But unfortunately
that's not the case. Again the avail value of the two calls differs sometimes.

How can I query the three values atomically? Can i do that at all?

Also, snd_pcm_hw_params_is_monotonic() always returns 0 on all my
devices. I am calling that function after having set both HW and SW
params. Kernel is 2.6.27, alsa-libs is 1.0.19. The kernel itself does
monotonic/hrtimers just fine.

Hmm, last week I started this discussion about "snd_pcm_busy_for()"
(aka granularity API). Who can I bribe to get an API like this?
Although snd_pcm_busy_for() would suit me much better than just a call
to query the granularity, I'd be happy with either...

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

             reply	other threads:[~2009-02-16  2:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16  2:35 Lennart Poettering [this message]
2009-02-16 16:08 ` Rationale behind snd_pcm_htimestamp() Takashi Iwai
2009-02-18 21:51   ` Lennart Poettering
2009-02-25 15:13     ` Takashi Iwai
2009-02-25 21:42       ` Lennart Poettering

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=20090216023509.GA16494@tango.0pointer.de \
    --to=mznyfn@0pointer.de \
    --cc=alsa-devel@alsa-project.org \
    /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.