51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
# HG changeset patch
|
|
# User tiwai
|
|
# Date 1194263206 -3600
|
|
# Node ID c82755151f76b40eb0f99dec961b073f450763bb
|
|
# Parent 8069595414f25236461492265786670352ac4d3a
|
|
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.
|
|
|
|
diff -r 8069595414f2 -r c82755151f76 src/pcm/pcm_ioplug.c
|
|
--- a/src/pcm/pcm_ioplug.c Tue Oct 30 14:28:30 2007 +0100
|
|
+++ b/src/pcm/pcm_ioplug.c Mon Nov 05 12:46:46 2007 +0100
|
|
@@ -313,7 +313,7 @@ static int snd_pcm_ioplug_hw_refine(snd_
|
|
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);
|
|
@@ -340,6 +340,26 @@ static int snd_pcm_ioplug_hw_refine(snd_
|
|
err = refine_back_time_and_size(params, SND_PCM_HW_PARAM_BUFFER_TIME,
|
|
SND_PCM_HW_PARAM_BUFFER_SIZE,
|
|
SND_PCM_HW_PARAM_BUFFER_BYTES);
|
|
+ if (err < 0)
|
|
+ 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;
|
|
}
|