From: Jaroslav Kysela Date: Sat, 24 Nov 2001 10:53:14 +0000 (+0000) Subject: Proper fix for the overflow X-Git-Tag: android-x86-9.0-r1~2636 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=857d492b99ce75ba23a4c9f1d27962ca3d05987d;p=android-x86%2Fexternal-alsa-lib.git Proper fix for the overflow --- diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index b9545151..e10f8451 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -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)