vlc-2.2.4-alsa-large-buffers.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. X-Git-Url: https://git.videolan.org/?p=vlc.git;a=blobdiff_plain;f=modules%2Faudio_output%2Falsa.c;h=4e9fd53592d048baa8b57f30df15ab5806139d07;hp=2d1f99e9cb743bca12c6bdf32cc84a92d07fda8b;hb=47f74a83c161173b0d15e95dab8ceb7c97de51b4;hpb=6ae2905ef7fbc7de3a3a4a1bdf8ad6df46ce570a
  2. diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
  3. index 2d1f99e..4e9fd53 100644
  4. --- a/modules/audio_output/alsa.c
  5. +++ b/modules/audio_output/alsa.c
  6. @@ -495,6 +495,15 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
  7. }
  8. sys->rate = fmt->i_rate;
  9. +#if 1 /* work-around for period-long latency outputs (e.g. PulseAudio): */
  10. + param = AOUT_MIN_PREPARE_TIME;
  11. + val = snd_pcm_hw_params_set_period_time_near (pcm, hw, &param, NULL);
  12. + if (val)
  13. + {
  14. + msg_Err (aout, "cannot set period: %s", snd_strerror (val));
  15. + goto error;
  16. + }
  17. +#endif
  18. /* Set buffer size */
  19. param = AOUT_MAX_ADVANCE_TIME;
  20. val = snd_pcm_hw_params_set_buffer_time_near (pcm, hw, &param, NULL);
  21. @@ -503,14 +512,22 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
  22. msg_Err (aout, "cannot set buffer duration: %s", snd_strerror (val));
  23. goto error;
  24. }
  25. -
  26. - param = AOUT_MIN_PREPARE_TIME;
  27. +#if 0
  28. + val = snd_pcm_hw_params_get_buffer_time (hw, &param, NULL);
  29. + if (val)
  30. + {
  31. + msg_Warn (aout, "cannot get buffer time: %s", snd_strerror(val));
  32. + param = AOUT_MIN_PREPARE_TIME;
  33. + }
  34. + else
  35. + param /= 2;
  36. val = snd_pcm_hw_params_set_period_time_near (pcm, hw, &param, NULL);
  37. if (val)
  38. {
  39. msg_Err (aout, "cannot set period: %s", snd_strerror (val));
  40. goto error;
  41. }
  42. +#endif
  43. /* Commit hardware parameters */
  44. val = snd_pcm_hw_params (pcm, hw);