mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
gstavviddec: Limit default number of decoder threads
When the `max-threads` property is not specified, GStreamer defaults to the amount of CPU threads in the system. The number of threads used in avdec has a direct impact on the latency of the decoder, which is of as many frames as threads. Therefore, big numbers of threads can make latency levels that can be problematic in some applications. For this reason, ffmpeg emits a warning when more than 16 threads are requested. This patch limits the default number of threads to 16. This affects only computers with more than 16 CPU threads when using avviddec without setting `max-threads`.
This commit is contained in:
parent
77f63c2457
commit
b7d450b118
1 changed files with 2 additions and 1 deletions
|
@ -546,7 +546,8 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
|
|||
* to one frame per thread. We thus need to calculate the thread count ourselves */
|
||||
if ((!(oclass->in_plugin->capabilities & AV_CODEC_CAP_AUTO_THREADS)) ||
|
||||
(ffmpegdec->context->thread_type & FF_THREAD_FRAME))
|
||||
ffmpegdec->context->thread_count = gst_ffmpeg_auto_max_threads ();
|
||||
ffmpegdec->context->thread_count =
|
||||
MIN (gst_ffmpeg_auto_max_threads (), 16);
|
||||
else
|
||||
ffmpegdec->context->thread_count = 0;
|
||||
} else
|
||||
|
|
Loading…
Reference in a new issue