summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlicia Boya GarcĂ­a <ntrrgc@gmail.com>2019-12-19 17:58:56 +0100
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-09-28 18:07:31 +0000
commit970c83ea282caf3a6550894403a5dc9a49ec9945 (patch)
tree467058a4e16a92da1542376cf75837c0e7fa9813
parentc14d933e44ddea6bae06e23ec318c7c12f690685 (diff)
downloadgst-libav-970c83ea282caf3a6550894403a5dc9a49ec9945.tar.gz
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`. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/93>
-rw-r--r--ext/libav/gstavviddec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
index ea367b2..aa4ad3d 100644
--- a/ext/libav/gstavviddec.c
+++ b/ext/libav/gstavviddec.c
@@ -494,7 +494,8 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
if (ffmpegdec->max_threads == 0) {
if (!(oclass->in_plugin->capabilities & AV_CODEC_CAP_AUTO_THREADS))
- 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