]> git.sesse.net Git - vlc/commitdiff
ALSA: request large enough buffers first (refs #10422)
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 19 Mar 2015 21:51:21 +0000 (23:51 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 19 Mar 2015 21:54:05 +0000 (23:54 +0200)
With the current input clock and decoder buffering code, getting large
buffers is essential. So favor that over having short audio periods.
(Ideally the audio period should probably be an half or a third of the
PTS delay, rather than hard-coded to 40 ms, but that is a separate
issue).

modules/audio_output/alsa.c

index fd40d85d2dca3d91dd7445fcbed6428a2c364db2..229d1881da8674beff2a685a8aaa5b3a39175cf8 100644 (file)
@@ -495,15 +495,6 @@ 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);
@@ -512,22 +503,14 @@ 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;
     }
-#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;
+
+    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
 
     /* Commit hardware parameters */
     val = snd_pcm_hw_params (pcm, hw);