From: Lennart Poettering <mznyfn@0pointer.de>
To: alsa-devel@alsa-project.org
Subject: Re: Misusing snd_pcm_avail_update()
Date: Wed, 28 Jan 2009 19:30:01 +0100 [thread overview]
Message-ID: <20090128183000.GG11770@tango.0pointer.de> (raw)
In-Reply-To: <497A04D6.4000603@ladisch.de>
On Fri, 23.01.09 18:56, Clemens Ladisch (clemens@ladisch.de) wrote:
>
> Takashi Iwai wrote:
> > [...]
> > My main concern is what kernel <-> user API is needed in addition or
> > needed to be changed.
> >
> > If it's a question how to pass the granularity to user-space, usually
> > it's a constant value, and thus it can be put somewhere in the
> > existing struct, or add a single ioctl.
>
> Most PCI devices have 32 bytes; wavetable chips have a constant time
> (5.33 ms, i.e., resampled to 256 framesat 48 kHz). But the interesting
> cases are where the granularity is dependent on the period size, or
> where the application could choose some arbitrary value (USB). For
> these cases, it would be very useful to have the granularity as an
> interval in the PCM hardware parameters (or probably three: bytes/
> frames/time).
>
> In the case of granularity==period, this allows PulseAudio to detect
> that it has to work with small periods after it has set a small upper
> bound for the granularity. (This is exactly what the hw_param
> dependencies were designed for.)
>
> > OTOH, if it has to be implemented as a form of snd_pcm_busy_for(),
> > the kernel needs the compuation like the above. That's my concern.
>
> Instead of writing a callback in the USB driver to compute the time
> until the next underrun, I'd rather rip out that fast start code.
> So, no kernel computation is needed. :-)
While I think it would be good not have this kind of double-buffering
I wonder if this is really future-proof. i.e. can this done with every
driver that uses 'fast starts'?
> Anyway, regardless of how the API looks, I see two compatibility
> concerns:
> * For many devices (legacy ISA, etc.), we just don't know the correct
> value.
But it should be possible to pick a safe boundary, shouldn't it?
> * What should alsa-lib do when it runs on an old kernel? It could
> return a worst-case estimate (period size), but this would cause PA
> to use small periods. Perhaps it would be better to return some error
> ("don't know").
If we'd do it the the busy_for() API we could simply return
buffer_size - avail_update() - extra_margin. Or simply return
ENOSUPP. That would be fine too.
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:[~2009-01-28 18:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-20 2:57 Misusing snd_pcm_avail_update() Lennart Poettering
2009-01-20 8:29 ` Clemens Ladisch
2009-01-20 8:32 ` Clemens Ladisch
2009-01-20 14:26 ` Lennart Poettering
2009-01-20 18:48 ` Clemens Ladisch
2009-01-20 20:29 ` Lennart Poettering
2009-01-21 0:39 ` Takashi Iwai
2009-01-22 22:20 ` Lennart Poettering
2009-01-23 17:13 ` Takashi Iwai
2009-01-23 17:56 ` Clemens Ladisch
2009-01-24 9:52 ` Takashi Iwai
2009-01-28 18:30 ` Lennart Poettering [this message]
2009-01-29 8:28 ` Clemens Ladisch
2009-01-28 18:26 ` Lennart Poettering
2009-01-23 18:49 ` 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=20090128183000.GG11770@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox