mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
ioplug - Fix the refinement of period_* after periods
When changing only PERIODS after BUFFER_*, ioplug doesn't update the corresponding PERIOD_* parameters properly. This should fix ALSA bug#2601.
This commit is contained in:
parent
2e7cc001a9
commit
07137c0267
1 changed files with 21 additions and 1 deletions
|
|
@ -313,7 +313,7 @@ static int snd_pcm_ioplug_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
if (err < 0)
|
||||
return err;
|
||||
change2 |= err;
|
||||
/* periods = buffer_bytes / periods */
|
||||
/* periods = buffer_bytes / period_bytes */
|
||||
err = rule_div(params, SND_PCM_HW_PARAM_PERIODS,
|
||||
SND_PCM_HW_PARAM_BUFFER_BYTES,
|
||||
SND_PCM_HW_PARAM_PERIOD_BYTES);
|
||||
|
|
@ -344,6 +344,26 @@ static int snd_pcm_ioplug_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
return err;
|
||||
}
|
||||
|
||||
/* period_bytes = buffer_bytes / periods */
|
||||
err = rule_div(params, SND_PCM_HW_PARAM_PERIOD_BYTES,
|
||||
SND_PCM_HW_PARAM_BUFFER_BYTES,
|
||||
SND_PCM_HW_PARAM_PERIODS);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if (err) {
|
||||
/* update period_size and period_time */
|
||||
change |= err;
|
||||
err = snd_ext_parm_interval_refine(hw_param_interval(params, SND_PCM_HW_PARAM_PERIOD_BYTES),
|
||||
io->params, SND_PCM_IOPLUG_HW_PERIOD_BYTES);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = refine_back_time_and_size(params, SND_PCM_HW_PARAM_PERIOD_TIME,
|
||||
SND_PCM_HW_PARAM_PERIOD_SIZE,
|
||||
SND_PCM_HW_PARAM_PERIOD_BYTES);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
params->info = SND_PCM_INFO_BLOCK_TRANSFER;
|
||||
p = &io->params[SND_PCM_IOPLUG_HW_ACCESS];
|
||||
if (p->active) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue