diff options
author | Abramo Bagnara <abramo@alsa-project.org> | 2001-01-22 16:07:11 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo@alsa-project.org> | 2001-01-22 16:07:11 +0000 |
commit | c6f6c231c0b98b8bc4ed1b54da2ecc69a73bc52b (patch) | |
tree | f1a7e9bbf876c2b3a133e0021feceba816433c48 /src/pcm/pcm_plug.c | |
parent | 5c84940c1f587782de2212fe3977bcc0dba0c8d0 (diff) |
Fixed pcm_plug race condition
Diffstat (limited to 'src/pcm/pcm_plug.c')
-rw-r--r-- | src/pcm/pcm_plug.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index 67f6b097..ebf7a526 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -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); |