[vlc-commits] PulseAudio: correct tlength value w.r.t. to VLC behavior
Rémi Denis-Courmont
git at videolan.org
Tue Jul 19 18:26:49 CEST 2011
vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 19 18:11:11 2011 +0300| [541a18d06d7477d1d97a867fd25a3979d8235834] | committer: Rémi Denis-Courmont
PulseAudio: correct tlength value w.r.t. to VLC behavior
(cherry picked from commit 981005b0e1d9c015166280e7509305c5951c1518)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=541a18d06d7477d1d97a867fd25a3979d8235834
---
modules/audio_output/pulse.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 08311ec..46e57ac 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -395,7 +395,13 @@ static int Open(vlc_object_t *obj)
const uint32_t byterate = pa_bytes_per_second(&ss);
struct pa_buffer_attr attr;
attr.maxlength = -1;
- attr.tlength = byterate * AOUT_MAX_PREPARE_TIME / CLOCK_FREQ;
+ /* PulseAudio assumes that tlength bytes are available in the buffer. Thus
+ * we need to be conservative and set the minimum value that the VLC
+ * audio decoder thread warrants. Otherwise, PulseAudio buffers will
+ * underrun on hardware with large buffers. VLC keeps at least
+ * AOUT_MIN_PREPARE and at most AOUT_MAX_PREPARE worth of audio buffers.
+ * TODO? tlength could be adaptively increased to reduce wakeups. */
+ attr.tlength = byterate * AOUT_MIN_PREPARE_TIME / CLOCK_FREQ;
attr.prebuf = 0; /* trigger manually */
attr.minreq = -1;
attr.fragsize = 0; /* not used for output */
More information about the vlc-commits
mailing list