vd_lavc: request 1 more threads than CPU cores

This duplicates the logic which FFmpeg's libavcodec uses. The effects
are unknown, though it's somewhat clear that a single thread doesn't
necessarily saturate a single CPU.

(Eventually we should just let FFmpeg auto-init the thread count, but
for now I prefer it this way, so e.g. verbose mode will print the
thread count.)
This commit is contained in:
wm4 2015-03-05 12:55:36 +01:00
parent 4e3f8ccb9d
commit 9657e5a2ca
1 changed files with 2 additions and 0 deletions

View File

@ -135,6 +135,8 @@ void mp_set_avcodec_threads(struct mp_log *l, AVCodecContext *avctx, int threads
threads = 1;
} else {
mp_verbose(l, "Detected %d logical cores.\n", threads);
if (threads > 1)
threads += 1; // extra thread for better load balancing
}
// Apparently some libavcodec versions have or had trouble with more
// than 16 threads, and/or print a warning when using > 16.