[vlc-commits] Revert "ALSA: request large enough buffers first (refs #10422)"

Rémi Denis-Courmont git at videolan.org
Sun Nov 1 17:12:26 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov  1 18:11:59 2015 +0200| [47f74a83c161173b0d15e95dab8ceb7c97de51b4] | committer: Rémi Denis-Courmont

Revert "ALSA: request large enough buffers first (refs #10422)"

This reverts commit 4aeccbd7667c65bd278111a26c2aab088bc60a20.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47f74a83c161173b0d15e95dab8ceb7c97de51b4
---

 modules/audio_output/alsa.c |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index 2d1f99e..4e9fd53 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -495,6 +495,15 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     }
     sys->rate = fmt->i_rate;
 
+#if 1 /* work-around for period-long latency outputs (e.g. PulseAudio): */
+    param = AOUT_MIN_PREPARE_TIME;
+    val = snd_pcm_hw_params_set_period_time_near (pcm, hw, &param, NULL);
+    if (val)
+    {
+        msg_Err (aout, "cannot set period: %s", snd_strerror (val));
+        goto error;
+    }
+#endif
     /* Set buffer size */
     param = AOUT_MAX_ADVANCE_TIME;
     val = snd_pcm_hw_params_set_buffer_time_near (pcm, hw, &param, NULL);
@@ -503,14 +512,22 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
         msg_Err (aout, "cannot set buffer duration: %s", snd_strerror (val));
         goto error;
     }
-
-    param = AOUT_MIN_PREPARE_TIME;
+#if 0
+    val = snd_pcm_hw_params_get_buffer_time (hw, &param, NULL);
+    if (val)
+    {
+        msg_Warn (aout, "cannot get buffer time: %s", snd_strerror(val));
+        param = AOUT_MIN_PREPARE_TIME;
+    }
+    else
+        param /= 2;
     val = snd_pcm_hw_params_set_period_time_near (pcm, hw, &param, NULL);
     if (val)
     {
         msg_Err (aout, "cannot set period: %s", snd_strerror (val));
         goto error;
     }
+#endif
 
     /* Commit hardware parameters */
     val = snd_pcm_hw_params (pcm, hw);



More information about the vlc-commits mailing list