From: Lennart Poettering <mznyfn@0pointer.de>
To: alsa-devel@alsa-project.org
Subject: Re: softvol and snd_pcm_rewind() is broken
Date: Wed, 16 Jul 2008 16:54:11 +0200 [thread overview]
Message-ID: <20080716145411.GA22968@tango.0pointer.de> (raw)
In-Reply-To: <20080716143004.GA21124@tango.0pointer.de>
On Wed, 16.07.08 16:30, Lennart Poettering (mznyfn@0pointer.de) wrote:
> Heya!
>
> With 1.0.17rc3 snd_pcm_rewind() is broken for softvol as it seems:
>
> - Sometimes the sound becomes heavily distorted after such a seek:
>
> http://mailman.alsa-project.org/pipermail/alsa-devel/2008-June/008860.html
>
> - And snd_pcm_rewind() might return a value that is higher than was
> passed in, which as far as I understood should never happen:
>
> http://mailman.alsa-project.org/pipermail/alsa-devel/2008-April/007308.html
>
> These two issues might be caused by the same error.
>
> Takashi, Jaroslav, how can I bribe you into fixing this? I'd love to
> release my new PulseAudio version soon which heavily relies on
> snd_pcm_rewind(), but unfortunately the most important driver (hda
> with softvol) makes the most problems with it. :-(
Hmm, if I understand snd_pcm_plugin_rewind() in pcm_plugin.c
correctly, then I read it like this:
1. we clamp the input frames to hw_avail
2. we convert this to slave frames
3. we issue the rewind
4. we convert back to client frames
5. we return hw_avail.
Step #1 seems wrong to me. The code will make sure that we rewind as
least as much as can be written right now. Does that make any sense? I
don't think so. Shouldn't this be a clamp that makes sure that we
rewind at most as much as the buffer is filled right now?
I.e. something along the lines of:
if (frames > buffer_size - n)
frames = buffer_size - n;
Also, step #5 seems wrong to me. Shouldn't we return the result of the
second conversion? I.e. shouldn't "return n" be replaced by "return
(snd_pcm_sframes_t) frames"?
I am puzzled though, not sure if I understood that function correctly
at all.
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-07-16 14:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-16 14:30 softvol and snd_pcm_rewind() is broken Lennart Poettering
2008-07-16 14:54 ` Lennart Poettering [this message]
2008-07-17 9:56 ` Takashi Iwai
2008-07-18 16:47 ` Stewart Adam
2008-07-19 9:25 ` Takashi Iwai
2008-07-18 19:30 ` Lennart Poettering
2008-07-19 17:01 ` Stewart Adam
2008-07-20 15:41 ` Takashi Iwai
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=20080716145411.GA22968@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.