[FFmpeg-cvslog] arm/aarch64: Use mach_absolute_time as timer on apple platforms

Martin Storsjö git at videolan.org
Sun Feb 21 23:06:03 EET 2021


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Fri Feb 12 12:27:03 2021 +0200| [ee040a7fc23b9dbd8db6c4291e43c653d61325fe] | committer: Martin Storsjö

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 at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee040a7fc23b9dbd8db6c4291e43c653d61325fe
---

 libavutil/aarch64/timer.h | 8 +++++++-
 libavutil/arm/timer.h     | 8 +++++++-
 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
 



More information about the ffmpeg-cvslog mailing list