aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-02-12 12:27:03 +0200
committerMartin Storsjö <martin@martin.st>2021-02-21 22:41:34 +0200
commitee040a7fc23b9dbd8db6c4291e43c653d61325fe (patch)
treec4f478993e14929686a4430e881c22f3d77f3efe /libavutil
parent5ca40d6d941bd802a7b953b3a21cd075725d5c98 (diff)
downloadffmpeg-ee040a7fc23b9dbd8db6c4291e43c653d61325fe.tar.gz
arm/aarch64: Use mach_absolute_time as timer on apple platforms
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>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/aarch64/timer.h8
-rw-r--r--libavutil/arm/timer.h8
2 files changed, 14 insertions, 2 deletions
diff --git a/libavutil/aarch64/timer.h b/libavutil/aarch64/timer.h
index b570039416..8b28fd354c 100644
--- a/libavutil/aarch64/timer.h
+++ b/libavutil/aarch64/timer.h
@@ -24,7 +24,13 @@
#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
diff --git a/libavutil/arm/timer.h b/libavutil/arm/timer.h
index 5e8bc8edd0..caf23e2a5a 100644
--- a/libavutil/arm/timer.h
+++ b/libavutil/arm/timer.h
@@ -24,7 +24,13 @@
#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