From 58aa06bea01c7d5a4ed06c502838a31d518f6a6b Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Thu, 14 Apr 2022 23:14:27 +0200 Subject: [PATCH] avutil/cpu: #define _GNU_SOURCE before including any standard headers Otherwise its effect might not work causing CPU_COUNT to not get defined. Fixes cpu count detection to actually use sched_getaffinity if available. Signed-off-by: Marton Balint --- libavutil/cpu.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 833c220192..24b99d2554 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -16,16 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include -#include - -#include "attributes.h" -#include "cpu.h" -#include "cpu_internal.h" #include "config.h" -#include "opt.h" -#include "common.h" #if HAVE_SCHED_GETAFFINITY #ifndef _GNU_SOURCE @@ -33,6 +24,17 @@ #endif #include #endif + +#include +#include +#include + +#include "attributes.h" +#include "cpu.h" +#include "cpu_internal.h" +#include "opt.h" +#include "common.h" + #if HAVE_GETPROCESSAFFINITYMASK || HAVE_WINRT #include #endif