avviddec: use a more conservative default number of threads

When doing per-frame multithreading, FFmpeg introduces a
delay of one frame per thread. On a machine with a high
number of cores, the default maximum of 16 can easily
lead to deadlocks in multiqueue.

The ideal situation would have multiqueue query a latency
downstream to add to its maximum, but that's not easily
implemented.

For now simply use a lower default maximum of 4, this should
usually still be enough for real-time playback purposes, and
can of course be set by the user through the max-threads
property.
This commit is contained in:
Mathieu Duponchelle 2020-05-21 15:47:11 +02:00
parent 776d8a6617
commit 552e9c3659

View file

@ -581,7 +581,7 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
if ((!(oclass->in_plugin->capabilities & AV_CODEC_CAP_AUTO_THREADS)) ||
(ffmpegdec->context->thread_type & FF_THREAD_FRAME))
ffmpegdec->context->thread_count =
MIN (gst_ffmpeg_auto_max_threads (), 16);
MIN (gst_ffmpeg_auto_max_threads (), 4);
else
ffmpegdec->context->thread_count = 0;
} else