[vlc-devel] Fixing long latency audio outputs like Airplay

David Fuhrmann david.fuhrmann at gmail.com
Sun Jun 21 18:00:05 CEST 2015

Hello All,

As discussed in Hamburg, I tried some settings now to fix Airplay audio output.

The problem is that (the original) Airplay specification defines a fixed 2 seconds latency for each audio device. Additionally, the auhal audio output has an internal buffer, which adds more delay. While we can try to keep the second latency down to a small value, we need to cope with a audio latency of some value slightly bigger than 2 secs in some way, to support Airplay.

Remi said that 2 sec is the maximum value supported by VLC, so this seems not to be sufficient for Airplay. As advised, I tried the following patch:

diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index 630be72..86117fd 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -37,7 +37,7 @@
 /* Buffers which arrive in advance of more than AOUT_MAX_PREPARE_TIME
  * will cause the calling thread to sleep */
-#define AOUT_MAX_PREPARE_TIME           (2 * CLOCK_FREQ)
+#define AOUT_MAX_PREPARE_TIME           (3 * CLOCK_FREQ)
 /* Buffers which arrive after pts - AOUT_MIN_PREPARE_TIME will be trashed
  * to avoid too heavy resampling */

But unfortunately, this does not seem to help as the only change.
The only way to improve the situation, seems to also increase the input caching size. Until now, I suggested people to increase caching to „high latency“ in the settings, which seems to fixed the issue so far.

As we cannot let the user change such values manually, last year I suggested to increase the default caching values for OS X: https://mailman.videolan.org/pipermail/vlc-devel/2014-April/097833.html <https://mailman.videolan.org/pipermail/vlc-devel/2014-April/097833.html> But this patch was found ugly and was rejected.

Any idea how this problem can be solved? Currently, I only see the possibility to increase the default caching values, in one way or another.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20150621/5ed1318b/attachment.html>

More information about the vlc-devel mailing list