[vlc-devel] [PATCH 2/6] coreaudio: always initialize the timebase

Thomas Guillem thomas at gllm.fr
Fri Aug 16 10:55:32 CEST 2019


It was not initialized in the unfair_lock was not available.
---
 modules/audio_output/coreaudio_common.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index 836a5f6de4..1720a1a5f9 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -64,11 +64,12 @@ static void
 ca_init_once(void)
 {
     unfair_lock.lock = os_unfair_lock_lock;
-    if (!unfair_lock.lock)
-        return;
-    unfair_lock.unlock = os_unfair_lock_unlock;
-    if (!unfair_lock.unlock)
-        unfair_lock.lock = NULL;
+    if (likely(unfair_lock.lock))
+    {
+        unfair_lock.unlock = os_unfair_lock_unlock;
+        if (unlikely(!unfair_lock.unlock))
+            unfair_lock.lock = NULL;
+    }
 
     if (mach_timebase_info(&tinfo) != KERN_SUCCESS)
         tinfo.numer = tinfo.denom = 0;
-- 
2.20.1



More information about the vlc-devel mailing list