[vlc-devel] [PATCH] ALSA: set periods before setting buffer time
Edward Sheldrake
ejsheldrake at gmail.com
Sun Mar 11 16:16:04 CET 2012
Fixes "cannot set buffer duration near 3000000 us: Invalid argument"
error, resulting in no sound, with HDA audio hardware and 44100Hz sources.
Signed-off-by: Edward Sheldrake <ejsheldrake at gmail.com>
---
modules/audio_output/alsa.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index 5f6385b..81c1834 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -449,6 +449,13 @@ static int Open (vlc_object_t *obj)
goto error;
}
+ val = snd_pcm_hw_params_set_periods_first (pcm, hw, ¶m, NULL);
+ if (val)
+ {
+ msg_Err (aout, "cannot select periods: %s", snd_strerror (val));
+ goto error;
+ }
+
/* Set buffer size */
param = AOUT_MAX_ADVANCE_TIME;
val = snd_pcm_hw_params_set_buffer_time_near (pcm, hw, ¶m, NULL);
@@ -459,13 +466,6 @@ static int Open (vlc_object_t *obj)
goto error;
}
- val = snd_pcm_hw_params_set_periods_first (pcm, hw, ¶m, NULL);
- if (val)
- {
- msg_Err (aout, "cannot select periods: %s", snd_strerror (val));
- goto error;
- }
-
/* Commit hardware parameters */
val = snd_pcm_hw_params (pcm, hw);
if (val < 0)
--
1.7.9.3
More information about the vlc-devel
mailing list