summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-05 12:34:34 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-01-25 17:00:18 +0900
commit12c316d95e19d3135528e28683bef9da1726efcd (patch)
treeb5065c1732ac4fe7593939d4ae119df18ee85741 /common
parentcf997ff6914a46136aead7293cfcc7c2b8682a5c (diff)
downloadmpv-12c316d95e19d3135528e28683bef9da1726efcd.tar.bz2
mpv-12c316d95e19d3135528e28683bef9da1726efcd.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')
-rw-r--r--common/av_common.c5
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;