Fixed pcm_plug race condition

This commit is contained in:
Abramo Bagnara 2001-01-22 16:07:11 +00:00
parent 5c84940c1f
commit c6f6c231c0
4 changed files with 73 additions and 52 deletions

View file

@ -488,6 +488,8 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
interval_t t;
const interval_t *sbuffer_size;
const interval_t *srate, *crate;
unsigned int rate_min, srate_min;
int rate_mindir, srate_mindir;
format_mask = snd_pcm_hw_param_value_mask(params,
SND_PCM_HW_PARAM_FORMAT);
sformat_mask = snd_pcm_hw_param_value_mask(sparams,
@ -512,6 +514,15 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
if (err < 0)
return err;
/* This is a temporary hack, waiting for a better solution */
rate_min = snd_pcm_hw_param_value_min(params, SND_PCM_HW_PARAM_RATE, &rate_mindir);
srate_min = snd_pcm_hw_param_value_min(sparams, SND_PCM_HW_PARAM_RATE, &srate_mindir);
if (rate_min == srate_min && srate_mindir > rate_mindir) {
err = _snd_pcm_hw_param_min(params, SND_PCM_HW_PARAM_RATE, srate_min, srate_mindir);
if (err < 0)
return err;
}
sbuffer_size = snd_pcm_hw_param_value_interval(sparams, SND_PCM_HW_PARAM_BUFFER_SIZE);
crate = snd_pcm_hw_param_value_interval(params, SND_PCM_HW_PARAM_RATE);
srate = snd_pcm_hw_param_value_interval(sparams, SND_PCM_HW_PARAM_RATE);