mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
pcm: null: Do not allow a period size of 0
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> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
fc0e54c3cc
commit
0d92f2d39a
1 changed files with 11 additions and 1 deletions
|
|
@ -261,7 +261,17 @@ 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)
|
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.
|
||||||
|
*/
|
||||||
|
err = _snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_PERIOD_SIZE, 1,
|
||||||
|
0);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
err = snd_pcm_hw_refine_soft(pcm, params);
|
||||||
params->info = SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID |
|
params->info = SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID |
|
||||||
SND_PCM_INFO_RESUME | SND_PCM_INFO_PAUSE;
|
SND_PCM_INFO_RESUME | SND_PCM_INFO_PAUSE;
|
||||||
params->fifo_size = 0;
|
params->fifo_size = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue