codec: cap FFmpeg decoder frame threads at 4
threads=auto spawns one decode thread per logical core per decoder (16 observed on a 24-core box); with cores-2 render workers decoding concurrently the machine is oversubscribed several times over and the playback-audio render thread gets starved (late chunks are dropped). 4 threads decode 1080p h264 far past real-time; preview throughput comes from the worker pool, not per-decoder threading. Applies to both the software open path and the hwaccel open path.
This commit is contained in:
@@ -195,7 +195,7 @@ pub fn open_hw_accel(
|
||||
// context frees it with the context.
|
||||
unsafe { (*context.as_mut_ptr()).hw_device_ctx = device };
|
||||
let mut opts = Dictionary::new();
|
||||
opts.set("threads", "auto");
|
||||
opts.set("threads", &crate::ffmpeg::decoder_threads());
|
||||
context
|
||||
.decoder()
|
||||
.open_as_with(codec, opts)
|
||||
|
||||
Reference in New Issue
Block a user