All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: twischer@de.adit-jv.com
Cc: alsa-devel@alsa-project.org
Subject: Re: [ALSA patch] [PATCH] pcm: null: Do not allow a period size of 0
Date: Fri, 05 Apr 2019 17:23:22 +0200	[thread overview]
Message-ID: <s5h7ec8xyqd.wl-tiwai@suse.de> (raw)
In-Reply-To: <1554473393-5757-1-git-send-email-twischer@de.adit-jv.com>

On Fri, 05 Apr 2019 16:09:53 +0200,
<twischer@de.adit-jv.com> wrote:
> 
> From: Timo Wischer <twischer@de.adit-jv.com>
> 
> Some applications do not expect that get_period_size_min() could
> return 0. Therefore these applications cannot use the null plugin without
> this patch.
> Due to there is no use case for having a period size of 0 this patch
> disallows a period size of 0 when using the null plugin.
> 
> Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
> ---
>  src/pcm/pcm_null.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c
> index ff61624..c95fad8 100644
> --- a/src/pcm/pcm_null.c
> +++ b/src/pcm/pcm_null.c
> @@ -261,7 +261,18 @@ static snd_pcm_sframes_t snd_pcm_null_mmap_commit(snd_pcm_t *pcm,
>  
>  static int snd_pcm_null_hw_refine(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
>  {
> -	int err = snd_pcm_hw_refine_soft(pcm, params);
> +	int err;
> +
> +	/* Do not return a period size of 0 because for example portaudio cannot
> +	 * handle it. In addition such small buffers would only increase the CPU
> +	 * load but there is no benefit when throwing the samples anyway away.
> +	 */
> +	err = _snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_PERIOD_SIZE,
> +					32, 0);

Why 32?  This is a virtual device, hence we don't need to set any
practical limit.  If the zero is harmfull, the next preferable
alternative is 1, when logically thinking.  Or does it cause a
problem?


thanks,

Takashi

      reply	other threads:[~2019-04-05 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 14:09 [PATCH] pcm: null: Do not allow a period size of 0 twischer
2019-04-05 15:23 ` Takashi Iwai [this message]

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=s5h7ec8xyqd.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 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.