diff options
author | wm4 <wm4@nowhere> | 2015-01-05 12:34:34 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-05 12:34:34 +0100 |
commit | d7dfbc86105ae2ad04a547042140cd12353e65e5 (patch) | |
tree | 728c678e61395e45cbaf2a7def317840e8126d7f /common/av_common.c | |
parent | 0f4bf347c52543057404e5c36f504ab18b901dba (diff) | |
download | mpv-d7dfbc86105ae2ad04a547042140cd12353e65e5.tar.bz2 mpv-d7dfbc86105ae2ad04a547042140cd12353e65e5.tar.xz |
player: use libavutil API to get number of CPUs
Our own code was introduced when FFmpeg didn't provide this API (or
maybe didn't even have a way to determine the CPU count). But now,
av_cpu_count() is available for all FFmpeg/Libav versions we support,
and there's no reason to have our own code.
libavutil's code seems to be slightly more sophisticated than our's, and
it's possible that the detected CPU count is different on some platforms
after this change.
Diffstat (limited to 'common/av_common.c')
-rw-r--r-- | common/av_common.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/common/av_common.c b/common/av_common.c index eb357d9f05..2d976bbc8d 100644 --- a/common/av_common.c +++ b/common/av_common.c @@ -22,6 +22,7 @@ #include <libavutil/dict.h> #include <libavutil/opt.h> #include <libavutil/error.h> +#include <libavutil/cpu.h> #include <libavcodec/avcodec.h> #include "common/common.h" @@ -30,8 +31,6 @@ #include "av_common.h" #include "codecs.h" -#include "osdep/numcores.h" - int mp_lavc_set_extradata(AVCodecContext *avctx, void *ptr, int size) { if (size) { @@ -129,7 +128,7 @@ void mp_set_av_packet(AVPacket *dst, struct demux_packet *mpkt, AVRational *tb) void mp_set_avcodec_threads(struct mp_log *l, AVCodecContext *avctx, int threads) { if (threads == 0) { - threads = default_thread_count(); + threads = av_cpu_count(); if (threads < 1) { mp_warn(l, "Could not determine thread count to use, defaulting to 1.\n"); threads = 1; |