From: Lennart Poettering <mznyfn@0pointer.de>
To: alsa-devel@alsa-project.org
Subject: Re: What does snd_pcm_delay() actually return?
Date: Fri, 13 Jun 2008 20:43:27 +0200 [thread overview]
Message-ID: <20080613184327.GB1954@tango.0pointer.de> (raw)
In-Reply-To: <Pine.LNX.4.61.0806131835180.1798@tm8103-a.perex-int.cz>
On Fri, 13.06.08 18:47, Jaroslav Kysela (perex@perex.cz) wrote:
> > > > What about just providing three pointers: curr_ptr, hw_ptr and
> > > > appl_ptr? curr_ptr corresponds to the point being played, and hw_ptr
> > > > is the point where the data was already sent to h/w, and appl_ptr is
> > > > the point where the data is filled by user. The above definitions are
> > > > all combinations of these pointers.
> > >
> > > But I think that curr_ptr can be managed in drivers, thus invisible to
> > > user space (except for snd_pcm_delay() propagation).
> >
> > Ditto for hw_ptr. Why is it hidden at all?
>
> Does it improve something to show this pointer to apps? I don't see any
> reason to show it outside alsa-lib.
As I already pointed out different applications need different kinds
of timing information. Some want to estimate when the next xrun will
happen, other's want the delay that the next write will take to be
played, even other's want how much of the already written data is not
yet played. Even other's want absolute times.
And I do follow Takashi in so far that when you'd just choose to
export the three pointers to userspace, so that they can be queried
atomically everybody can relatively easily calculate from these 'raw'
values what they need.
The problem I see with those 'cooked' values that are currently
exported (i.e. delay and update_avail) is that they only serve a
single purpose and there are so many different ways to use and
especially misuse them, as we have seen in the WINE case. Certainly,
the ptrs can be misused too, but at least all the information the
kernel has that it uses to calculate those 'cooked' values is
available to userspace too, so without too ugly code userspace can
always calculate what is necessary. If you only have a subset of the
cooked stuff and want to calculate the other cooked stuff from it your
in pain.
I think there are two extremes:
a) export the 'raw' info to userspace: the three pointers
b) export the 'cooked' info to userspace in all its variations:
similar to the API I suggested that would take an enum for
choosing the right timing parameter the app wants.
Everything in between these extremes would be incomplete.
I could live with any situation of these two. The question is do you
trust userspace programmers to use the three pointers correctly, or do
you want to make sure they get things right with the enum API?
Lennart
--
Lennart Poettering Red Hat, Inc.
lennart [at] poettering [dot] net ICQ# 11060553
http://0pointer.net/lennart/ GnuPG 0x1A015CC4
next prev parent reply other threads:[~2008-06-13 18:43 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-09 19:02 What does snd_pcm_delay() actually return? Lennart Poettering
2008-06-10 14:01 ` RafałMużyło
2008-06-10 14:36 ` James Courtier-Dutton
2008-06-11 16:56 ` Takashi Iwai
2008-06-11 20:24 ` Colin Guthrie
2008-06-11 21:40 ` Tomas Carnecky
2008-06-12 10:25 ` Takashi Iwai
2008-06-12 11:51 ` Colin Guthrie
2008-06-12 12:08 ` Takashi Iwai
2008-06-12 21:00 ` Lennart Poettering
2008-06-13 6:22 ` Takashi Iwai
2008-06-12 20:52 ` Lennart Poettering
2008-06-13 6:13 ` Takashi Iwai
2008-06-13 13:51 ` Lennart Poettering
2008-06-13 13:55 ` Jaroslav Kysela
2008-06-13 14:29 ` Lennart Poettering
2008-06-13 6:59 ` Takashi Iwai
2008-06-13 8:14 ` Jaroslav Kysela
2008-06-13 10:14 ` James Courtier-Dutton
2008-06-13 12:44 ` Colin Guthrie
2008-06-13 13:06 ` Jaroslav Kysela
2008-06-13 14:48 ` Lennart Poettering
2008-06-13 15:02 ` Jaroslav Kysela
2008-06-13 15:42 ` Takashi Iwai
2008-06-17 0:53 ` Eliot Blennerhassett
2008-06-13 14:38 ` Lennart Poettering
2008-06-13 15:27 ` Takashi Iwai
2008-06-13 15:44 ` Jaroslav Kysela
2008-06-13 15:59 ` Takashi Iwai
2008-06-13 16:20 ` Jaroslav Kysela
2008-06-13 16:38 ` Takashi Iwai
2008-06-13 16:48 ` Takashi Iwai
2008-06-13 19:55 ` James Courtier-Dutton
2008-06-16 12:07 ` Jaroslav Kysela
2008-06-19 17:59 ` Lennart Poettering
2008-06-13 19:59 ` James Courtier-Dutton
2008-06-13 14:25 ` Lennart Poettering
2008-06-13 15:55 ` Takashi Iwai
2008-06-13 16:11 ` Jaroslav Kysela
2008-06-13 16:26 ` Takashi Iwai
2008-06-13 16:47 ` Jaroslav Kysela
2008-06-13 16:52 ` Takashi Iwai
2008-06-13 17:37 ` Jaroslav Kysela
2008-06-13 18:23 ` Takashi Iwai
2008-06-13 18:48 ` Lennart Poettering
2008-06-13 18:43 ` Lennart Poettering [this message]
2008-06-13 18:29 ` Lennart Poettering
2008-06-13 18:46 ` Takashi Iwai
2008-06-13 19:01 ` Lennart Poettering
2008-06-13 19:05 ` Takashi Iwai
2008-06-13 18:22 ` Lennart Poettering
2008-06-13 18:32 ` Takashi Iwai
2008-06-14 9:51 ` James Courtier-Dutton
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=20080613184327.GB1954@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.