[vlc-commits] auhal: check getprop of kAudioDevicePropertyLatency

Thomas Guillem git at videolan.org
Tue Jul 16 12:09:26 CEST 2019


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jul 16 09:32:26 2019 +0200| [c645bd5ddbec6d5613768c5bc78a7c503036e584] | committer: Thomas Guillem

auhal: check getprop of kAudioDevicePropertyLatency

(cherry picked from commit 1f46192f33972d1b6d614218b3d0082a829ce478)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c645bd5ddbec6d5613768c5bc78a7c503036e584
---

 modules/audio_output/auhal.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 34c04f683e..d662fde326 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -1608,9 +1608,12 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
 
     /* get device latency */
     UInt32 i_latency_samples;
-    AO_GET1PROP(p_sys->i_selected_dev, UInt32, &i_latency_samples,
-                kAudioDevicePropertyLatency, kAudioObjectPropertyScopeOutput);
-    mtime_t i_latency_us = i_latency_samples * CLOCK_FREQ / fmt->i_rate;
+    mtime_t i_latency_us = 0;
+    int ret = AO_GET1PROP(p_sys->i_selected_dev, UInt32, &i_latency_samples,
+                          kAudioDevicePropertyLatency,
+                          kAudioObjectPropertyScopeOutput);
+    if (ret == VLC_SUCCESS)
+        i_latency_us += i_latency_samples * CLOCK_FREQ / fmt->i_rate;
 
     msg_Dbg(p_aout, "Current device has a latency of %lld us", i_latency_us);
 



More information about the vlc-commits mailing list