mirror of https://github.com/mpv-player/mpv
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:
parent
4e3f8ccb9d
commit
9657e5a2ca
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue