All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lennart Poettering <mznyfn@0pointer.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: Timer instability
Date: Tue, 24 Feb 2009 19:46:05 +0100	[thread overview]
Message-ID: <20090224184604.GA2253@tango.0pointer.de> (raw)
In-Reply-To: <s5h8wnvreab.wl%tiwai@suse.de>

On Tue, 24.02.09 17:27, Takashi Iwai (tiwai@suse.de) wrote:

> > > > Moreover I can now reproduce the same issue on snd-intel8x0, albeit it
> > > > takes more than a couple of minutes to make snd_pcm_avail() return
> > > > bogus data.
> > > > 
> > > > Somehow I get the feeling the problem is not so much the inaccuracy of
> > > > the pointer the kernel reports but in what alsa-libs does ith it.
> > > 
> > > Hrm... both cases the pointer calculation is relatively simple,
> > > and for "hw" PCM, the avail calculation is also very straightforward.
> > > So, my first suspect is about the pointer calculation.  But, of course
> > > we should check all possibilities.
> > > 
> > > Can you give a small testcase?
> > 
> > Ok, here's a little test case:
> > 
> > http://git.0pointer.de/?p=pulseaudio.git;a=blob_plain;f=src/tests/alsa-time-test.c
> 
> Finally have time to go back to this issue again now.
> 
> With your test case, indeed I get abort(), too.  However, checking
> through the code, you set stop_threshold to the boundary size like:
> 
>     r = snd_pcm_sw_params_get_boundary(swparams, &boundary);
>     r = snd_pcm_sw_params_set_stop_threshold(pcm, swparams, boundary);
> 
> This means essentially you are disabling the XRUN detection in the
> driver and keep it free-running.  So, no wonder avail gets over
> buffer_size.  It's actually an XRUN condition, but just ignored due to
> this setup.  (Usually, stop_threshould == buffer_size.)

Yes, threshold is set to boundary. But that's intended. Remember that
the original purpose of the tool is to graph _avail() and _delay()
against the time. For that I want to make sure the that timing stays
stable no matter what.

In reality this setting should not matter at all, because most machines
should be fast enough to keep the buffer filled even if we write one
sample at a time as it is done in the example.

The problems exposed in all the test data posted here for the various
sound cards are not normal normal buffer underruns.

In summary: just ignore the setting of the stop threshold. It is not
related to the problems exposed here.

Lennart

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

  reply	other threads:[~2009-02-24 18:46 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19  2:46 Timer instability Lennart Poettering
2009-02-19  6:52 ` Takashi Iwai
2009-02-20  1:22   ` Lennart Poettering
2009-02-20  1:26     ` Lennart Poettering
2009-02-20  1:50     ` Lennart Poettering
2009-02-20  7:26     ` Takashi Iwai
2009-02-20 20:34       ` Lennart Poettering
2009-02-21 16:36         ` Takashi Iwai
2009-02-22  3:14           ` Lennart Poettering
2009-02-23  2:42             ` Lennart Poettering
2009-02-23  2:56               ` Lennart Poettering
2009-02-23 19:20                 ` Lennart Poettering
2009-02-23 19:24                   ` Colin Guthrie
2009-02-24  3:21                   ` Lennart Poettering
2009-02-23  7:47             ` Takashi Iwai
2009-02-24 16:27             ` Takashi Iwai
2009-02-24 18:46               ` Lennart Poettering [this message]
2009-02-24 18:59                 ` Takashi Iwai
2009-02-24 19:04                   ` Jaroslav Kysela
2009-02-24 19:26                   ` Lennart Poettering
2009-02-24 20:37                     ` Takashi Iwai
2009-02-25 10:08                       ` Takashi Iwai
2009-02-25 10:22                         ` Takashi Iwai
2009-02-25 12:34                           ` Clive Messer
2009-02-25 13:36                             ` Takashi Iwai
2009-02-25 15:11                               ` Clive Messer
2009-02-25 15:51                                 ` Takashi Iwai
2009-02-25 16:24                                   ` Clive Messer
2009-02-25 16:39                                     ` Takashi Iwai
     [not found]                                       ` <200902251656.47813.clive@vacuumtube.org.uk>
2009-02-25 16:59                                         ` Takashi Iwai
2009-02-25 17:36                                           ` Clive Messer
2009-02-25 18:13                                             ` Takashi Iwai
2009-02-25 18:16                                               ` Clive Messer
2009-02-25 18:34                                               ` Clive Messer
2009-03-03 16:05                                                 ` Takashi Iwai
2009-03-03 17:41                                                   ` Takashi Iwai
2009-03-09 11:13                                                     ` Clive Messer
2009-03-09 11:20                                                       ` Takashi Iwai
2009-03-09 13:09                                                         ` Takashi Iwai
2009-02-25 15:04                             ` Takashi Iwai
2009-02-25 10:44                         ` Lennart Poettering
2009-02-24 21:16                     ` Lennart Poettering
2009-02-25 10:48                       ` Takashi Iwai
2009-02-25 10:57                         ` Jaroslav Kysela
2009-02-25 11:04                           ` Takashi Iwai
2009-02-25 11:10                             ` Jaroslav Kysela
2009-02-25 11:17                               ` 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=20090224184604.GA2253@tango.0pointer.de \
    --to=mznyfn@0pointer.de \
    --cc=alsa-devel@alsa-project.org \
    --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 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.