summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2006-03-05 18:37:13 +0000
committerPierre Ossman <ossman@cendio.se>2006-03-05 18:37:13 +0000
commit4e56725a60da8a1c80442ab16f7fe21147b143e9 (patch)
tree310f909d91ba2d915c864c973a9d78d80ca1bc29
parentf22d8ab3fe46e971f40bed21b159cf0c54d05f98 (diff)
It's safer to set buffer size than to try setting number of periods.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@628 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/modules/alsa-util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/modules/alsa-util.c b/src/modules/alsa-util.c
index c7be4790..683db6c0 100644
--- a/src/modules/alsa-util.c
+++ b/src/modules/alsa-util.c
@@ -262,6 +262,8 @@ int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, const pa_sample_spec *ss, uint3
[PA_SAMPLE_FLOAT32BE] = SND_PCM_FORMAT_FLOAT_BE,
};
assert(pcm_handle && ss && periods && period_size);
+
+ buffer_size = *periods * *period_size;
if ((ret = snd_pcm_hw_params_malloc(&hwparams)) < 0 ||
(ret = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0 ||
@@ -269,7 +271,7 @@ int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, const pa_sample_spec *ss, uint3
(ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[ss->format])) < 0 ||
(ret = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &r, NULL)) < 0 ||
(ret = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, ss->channels)) < 0 ||
- (*periods > 0 && (ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, periods, NULL)) < 0) ||
+ (*periods > 0 && (ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size)) < 0) ||
(*period_size > 0 && (ret = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, period_size, NULL)) < 0) ||
(ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0)
goto finish;