Hello,

Simple one-line patch to avoid creating threads on a filtergrpah which does not
get used during execution. This saves a superfluous thread creation and
tear-down cycle.

Besides cleanliness, the main driver for this feature is a system I have access
to with a large number of cores/threads. Threads count towards ulimits and the
default of 1 filtergraph thread per CPU thread is undesirable.
>From 999a38ae38178c2ab3ba8a9ef116e7ec08474302 Mon Sep 17 00:00:00 2001
From: DHE <g...@dehacked.net>
Date: Thu, 16 Nov 2017 20:09:37 -0500
Subject: [PATCH] ffmpeg_filter: use nb_threads=1 on unused filtergraph

Signed-off-by: DHE <g...@dehacked.net>
---
 fftools/ffmpeg_filter.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index aacc185..877fd67 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -340,6 +340,7 @@ int init_complex_filtergraph(FilterGraph *fg)
     graph = avfilter_graph_alloc();
     if (!graph)
         return AVERROR(ENOMEM);
+    graph->nb_threads = 1;
 
     ret = avfilter_graph_parse2(graph, fg->graph_desc, &inputs, &outputs);
     if (ret < 0)
-- 
2.9.5

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to