threads: check defines before using them in automatic thread detection
This commit is contained in:
parent
846dca1aa3
commit
7052618c7e
@ -152,7 +152,7 @@ typedef struct FrameThreadContext {
|
|||||||
static int get_logical_cpus(AVCodecContext *avctx)
|
static int get_logical_cpus(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
int ret, nb_cpus = 1;
|
int ret, nb_cpus = 1;
|
||||||
#if HAVE_SCHED_GETAFFINITY
|
#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)
|
||||||
cpu_set_t cpuset;
|
cpu_set_t cpuset;
|
||||||
|
|
||||||
CPU_ZERO(&cpuset);
|
CPU_ZERO(&cpuset);
|
||||||
@ -165,7 +165,7 @@ static int get_logical_cpus(AVCodecContext *avctx)
|
|||||||
SYSTEM_INFO sysinfo;
|
SYSTEM_INFO sysinfo;
|
||||||
GetSystemInfo(&sysinfo);
|
GetSystemInfo(&sysinfo);
|
||||||
nb_cpus = sysinfo.dwNumberOfProcessors;
|
nb_cpus = sysinfo.dwNumberOfProcessors;
|
||||||
#elif HAVE_SYSCTL
|
#elif HAVE_SYSCTL && defined(HW_NCPU)
|
||||||
int mib[2] = { CTL_HW, HW_NCPU };
|
int mib[2] = { CTL_HW, HW_NCPU };
|
||||||
size_t len = sizeof(nb_cpus);
|
size_t len = sizeof(nb_cpus);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user