[x264-devel] [Git][videolan/x264][master] Use sched_getaffinity on Android

Anton Mitrofanov (@BugMaster) gitlab at videolan.org
Mon Dec 30 15:16:32 UTC 2024



Anton Mitrofanov pushed to branch master at VideoLAN / x264


Commits:
52f7694d by Brad Smith at 2024-12-29T17:54:57+00:00
Use sched_getaffinity on Android

https://android.googlesource.com/platform/bionic/+/72e6fd42421dca80fb2776a9185c186d4a04e5f7

Android has had sched_getaffinity since Android 3.0. Builds need
to use _GNU_SOURCE.

- - - - -


1 changed file:

- common/cpu.c


Changes:

=====================================
common/cpu.c
=====================================
@@ -33,7 +33,7 @@
 #if HAVE_SYSCONF
 #include <unistd.h>
 #endif
-#if SYS_LINUX && !defined(__ANDROID__)
+#if SYS_LINUX
 #include <sched.h>
 #endif
 #if SYS_BEOS
@@ -545,10 +545,6 @@ int x264_cpu_num_processors( void )
     return x264_pthread_num_processors_np();
 
 #elif SYS_LINUX
-#ifdef __ANDROID__
-    // Android NDK does not expose sched_getaffinity
-    return sysconf( _SC_NPROCESSORS_CONF );
-#else
     cpu_set_t p_aff;
     memset( &p_aff, 0, sizeof(p_aff) );
     if( sched_getaffinity( 0, sizeof(p_aff), &p_aff ) )
@@ -561,7 +557,6 @@ int x264_cpu_num_processors( void )
         np += (((uint8_t *)&p_aff)[bit / 8] >> (bit % 8)) & 1;
     return np;
 #endif
-#endif
 
 #elif SYS_BEOS
     system_info info;



View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/52f7694ddd35209cb95225e7acce91d8a30cb57d

-- 
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/52f7694ddd35209cb95225e7acce91d8a30cb57d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the x264-devel mailing list