]> git.sesse.net Git - ffmpeg/commitdiff
arm/aarch64: Use mach_absolute_time as timer on apple platforms
authorMartin Storsjö <martin@martin.st>
Fri, 12 Feb 2021 10:27:03 +0000 (12:27 +0200)
committerMartin Storsjö <martin@martin.st>
Sun, 21 Feb 2021 20:41:34 +0000 (22:41 +0200)
This is much less precise than the cycle counter register, but
the cycle counter register is not available on apple platforms
(and on linux, it requires a kernel module for allowing user mode
access).

Signed-off-by: Martin Storsjö <martin@martin.st>
libavutil/aarch64/timer.h
libavutil/arm/timer.h

index b5700394163364007e49c4c65895c8354e213016..8b28fd354ca18f57a5368034f8e68530172ff805 100644 (file)
 #include <stdint.h>
 #include "config.h"
 
-#if HAVE_INLINE_ASM
+#if defined(__APPLE__)
+
+#include <mach/mach_time.h>
+
+#define AV_READ_TIME mach_absolute_time
+
+#elif HAVE_INLINE_ASM
 
 #define AV_READ_TIME read_time
 
index 5e8bc8edd07bd4e92b773c6517bbe7bb4576d8b9..caf23e2a5aaca9128f307990dc267508daa6df1b 100644 (file)
 #include <stdint.h>
 #include "config.h"
 
-#if HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__)
+#if defined(__APPLE__)
+
+#include <mach/mach_time.h>
+
+#define AV_READ_TIME mach_absolute_time
+
+#elif HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__)
 
 #define AV_READ_TIME read_time