public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Lennart Poettering <mznyfn@0pointer.de>
To: alsa-devel@alsa-project.org
Cc: Takashi Iwai <tiwai@suse.de>, Daniel Chen <seven.steps@gmail.com>
Subject: Re: Strange div-by-zero in alsa-lib 1.0.20's	snd_pcm_mmap_begin()
Date: Mon, 17 Aug 2009 16:36:15 +0200	[thread overview]
Message-ID: <20090817143615.GA16548@tango.0pointer.de> (raw)
In-Reply-To: <s5h3a7rvssh.wl%tiwai@suse.de>

On Mon, 17.08.09 08:49, Takashi Iwai (tiwai@suse.de) wrote:

> 
> At Sun, 16 Aug 2009 18:24:35 -0400,
> Daniel Chen wrote:
> > 
> > Hi,
> > 
> > In https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/412677
> > we're debugging an issue where snd_pcm_mmap_begin(), at line 6409 with
> > 
> > *offset = *pcm->appl.ptr % pcm->buffer_size;
> > 
> > appears to have pcm->buffer_size == 0. What's the correct approach in
> > handling this corner case?
> 
> We could add a sanity check in the function, of course.
> But relying on it doesn't sound nice.
> 
> At least, the caller should be surely at the certain state that the
> buffer has been set up, i.e. checking whether snd_pcm_state() returns
> SETUP or better condition.

Hmm, this bug is triggered in PA apparently. PA doesn't call
snd_pcm_mmap_begin() before the setup finished completely. Not sure
what's going on here, but this smells as if pcm->buffer_size is not
properly initialized.

Daniel, does this happen right-away on PA startup? Or does it
happen sometime while playing?

Could you get us the output of the PA startup phase when running
"pulsaudio -vvvv"? This should show us to which value the buffer_size
is initialized in the snd_pcm_t.

Lennart

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

  reply	other threads:[~2009-08-17 14:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-16 22:24 Strange div-by-zero in alsa-lib 1.0.20's snd_pcm_mmap_begin() Daniel Chen
2009-08-17  6:49 ` Takashi Iwai
2009-08-17 14:36   ` Lennart Poettering [this message]
2009-08-17 16:16     ` Daniel Chen
2009-08-17 16:38       ` 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=20090817143615.GA16548@tango.0pointer.de \
    --to=mznyfn@0pointer.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=seven.steps@gmail.com \
    --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