mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
Proper fix for the overflow
This commit is contained in:
parent
0d1cda0f1c
commit
857d492b99
1 changed files with 7 additions and 6 deletions
|
|
@ -464,8 +464,14 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int snd_pcm_plug_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED)
|
||||
static int snd_pcm_plug_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
unsigned int rate_min;
|
||||
|
||||
/* HACK: to avoid overflow in PARTBIT_RATE code */
|
||||
rate_min = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, NULL);
|
||||
if (rate_min < 4000)
|
||||
_snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_RATE, 4000, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -504,16 +510,11 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
|
|||
snd_pcm_format_t format;
|
||||
snd_interval_t t, buffer_size;
|
||||
const snd_interval_t *srate, *crate;
|
||||
unsigned int srate_min;
|
||||
if (plug->srate == -2)
|
||||
links |= SND_PCM_HW_PARBIT_RATE;
|
||||
else {
|
||||
snd_pcm_hw_param_refine_near(slave, sparams, SND_PCM_HW_PARAM_RATE,
|
||||
params);
|
||||
/* HACK: to avoid overflow in PARTBIT_RATE code */
|
||||
srate_min = snd_pcm_hw_param_get_min(sparams, SND_PCM_HW_PARAM_RATE, NULL);
|
||||
if (srate_min < 4000)
|
||||
_snd_pcm_hw_param_set_min(sparams, SND_PCM_HW_PARAM_RATE, srate_min, 1);
|
||||
}
|
||||
|
||||
if (plug->schannels == -2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue