[vlc-devel] [PATCH] auhal: fix wrong host time with SPDIF render callbacks

Thomas Guillem thomas at gllm.fr
Tue Jul 21 14:24:39 CEST 2020


This caused a freeze as the aout returned infinite values from time_get() with
SPDIF output.

Indeed, the inNow time is in the past (time when the callback is executed) and
a substraction with mach_absolute_time() returned a negative value.

The issue is revealed by 303d12153f67742ac21a31efb1eeb1f4aaa04f08 but the
SPDIF host time had always been wrong.
---
 modules/audio_output/auhal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index ab614c92a00..f99acfc27ec 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -978,8 +978,8 @@ RenderCallbackSPDIF(AudioDeviceID inDevice, const AudioTimeStamp * inNow,
     uint8_t *p_output = outOutputData->mBuffers[p_sys->i_stream_index].mData;
     size_t i_size = outOutputData->mBuffers[p_sys->i_stream_index].mDataByteSize;
 
-    uint64_t i_host_time = (inNow->mFlags & kAudioTimeStampHostTimeValid)
-                         ? inNow->mHostTime : 0;
+    uint64_t i_host_time = (inOutputTime->mFlags & kAudioTimeStampHostTimeValid)
+                         ? inOutputTime->mHostTime : 0;
 
     ca_Render(p_aout, 0, i_host_time, p_output, i_size);
 
-- 
2.20.1



More information about the vlc-devel mailing list