mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-22 08:31:07 +08:00
Merge remote-tracking branch 'qatar/master'
* qatar/master: FATE: add tests for dfa mpegaudiodec: fix seeking. mpegaudiodec: fix compilation when testing the unchecked bitstream reader threads: add sysconf based number of CPUs detection threads: always include necessary headers for number of CPUs detection threads: default to automatic thread count detection Changelog: restore version <next> header cook: K&R formatting cosmetics Conflicts: Changelog libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -34,9 +34,11 @@
|
||||
#if HAVE_SCHED_GETAFFINITY
|
||||
#define _GNU_SOURCE
|
||||
#include <sched.h>
|
||||
#elif HAVE_GETSYSTEMINFO
|
||||
#endif
|
||||
#if HAVE_GETSYSTEMINFO
|
||||
#include <windows.h>
|
||||
#elif HAVE_SYSCTL
|
||||
#endif
|
||||
#if HAVE_SYSCTL
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
@@ -44,6 +46,9 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#if HAVE_SYSCONF
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "internal.h"
|
||||
@@ -178,6 +183,10 @@ static int get_logical_cpus(AVCodecContext *avctx)
|
||||
ret = sysctl(mib, 2, &nb_cpus, &len, NULL, 0);
|
||||
if (ret == -1)
|
||||
nb_cpus = 0;
|
||||
#elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN)
|
||||
nb_cpus = sysconf(_SC_NPROC_ONLN);
|
||||
#elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)
|
||||
nb_cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
#endif
|
||||
av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);
|
||||
return FFMIN(nb_cpus, MAX_AUTO_THREADS);
|
||||
|
Reference in New Issue
Block a user