Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Timo Wischer <twischer@de.adit-jv.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH - Intervals v2 1/1] interval: Interpret (x x+1] correctly and return x+1
Date: Thu, 18 Oct 2018 20:57:56 +0200	[thread overview]
Message-ID: <s5hftx3qdzf.wl-tiwai@suse.de> (raw)
In-Reply-To: <c376a304-a683-d0aa-30b9-df65f9884644@de.adit-jv.com>

On Thu, 18 Oct 2018 17:55:32 +0200,
Timo Wischer wrote:
> 
> > But what I don't understand is why
> >
> > snd_interval_value() {
> > 	if (openmin)
> > 		return min+1;
> > 	return min;
> > }
> >
> > doesn't work.  I don't mean that this is better than returning max
> > (like your v1 patch), but just want to understand the problem
> > correctly.
> In the issue case which I had I got a buffer size < 2x period size
> while I have requested 16ms period and 32ms buffer. Unfortunately this
> results in continuously under runs.
> The following audio path was used: aplay->rate->dmix->hw. aplay
> streams with 22050 Hz. Therefore we got the following intervals:
> period: 16ms * 22,05 kHz = 352,8 frames => (352 353)
> buffer: 32ms * 22,05 kHz = 705,6 frames => [705 706]

But how can it be at the first place?  (352 353) is already empty as
the frames.  The time could be kept in this representation, but the
frames must be integer.

Which order of calls did it result in so?

We know that some order of calls make the selection impossible like
the above, especially when both time and bytes/frames are mixed.

> The buffer size will not end up with an interval of (705 706) similar
> to the period size because snd_pcm_rate_hw_refine_cchange() calls
> snd_interval_floor() for the buffer size. Therefore this value will be
> interpreted as an integer interval (integer flag is set) instead of a
> real interval further on.
> 
> With your solution we would use 353 frames for period and 705 frames
> for buffer. Therefore we will get Xruns because 2*353 > 705.
> 
> >
> >
> >>> IOW, if we have a good set of unit tests to cover most of possible use
> >>> cases and this is proven to improve all these, I'll happily take it.
> >>> But unfortunately there is no good test coverage, so far.
> >> At least I have executed several tests on my end which are using
> >> different combination of ALSA plugins
> >> (plug, rate, dmix, dsnoop), sample rates, channels, period and buffer
> >> sizes on different hardware with different
> >> sound cards.
> >> I would expect that you are talking about the tests in the test
> >> directory of the alsa-lib sources. Or is there
> >> anything else? May be I could try to extend/add some tests at least to
> >> reproduce the issue of this patch.
> > I'd think of a test program linked with these functions for executing
> > only this configuration stuff without actual plugins.  Then we can
> > give a bunch of sets to evaluate the extreme cases.
> So you mean only testing the corner cases of the functions of
> src/pcm/interval_inline.h without any other alsa-lib dependencies?

Yes.


Takashi

  reply	other threads:[~2018-10-18 18:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 11:33 [PATCH - Intervals v2 1/1] interval: Interpret (x x+1] correctly and return x+1 twischer
2018-10-18 12:02 ` Takashi Iwai
2018-10-18 12:28   ` Timo Wischer
2018-10-18 13:19     ` Takashi Iwai
2018-10-18 14:31       ` Timo Wischer
2018-10-18 14:45         ` Takashi Sakamoto
2018-10-18 15:16           ` Timo Wischer
2018-10-18 14:58         ` Takashi Iwai
2018-10-18 15:55           ` Timo Wischer
2018-10-18 18:57             ` Takashi Iwai [this message]
2018-10-22  7:19               ` Timo Wischer
2018-10-24  7:06                 ` Takashi Iwai
2018-10-24  7:44                   ` Timo Wischer
2018-10-24  7:48                     ` Takashi Iwai
2018-10-24  8:05                       ` Timo Wischer
2018-10-24 10:15                         ` Jaroslav Kysela

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=s5hftx3qdzf.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=twischer@de.adit-jv.com \
    /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