[FFmpeg-devel] [PATCH] ffmpeg_filter: use nb_threads=1 on unused filtergraph

Michael Niedermayer michael at niedermayer.cc
Sat Nov 18 12:56:16 EET 2017


On Thu, Nov 16, 2017 at 08:25:50PM -0500, DeHackEd wrote:
> 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.

>  ffmpeg_filter.c |    1 +
>  1 file changed, 1 insertion(+)
> 8900e0a4dfa60c9c6c0f0612489d85080b213db8  0001-ffmpeg_filter-use-nb_threads-1-on-unused-filtergraph.patch
> From 999a38ae38178c2ab3ba8a9ef116e7ec08474302 Mon Sep 17 00:00:00 2001
> From: DHE <git at 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 <git at 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;

if you checked that it doesnt reduce threads for simple & complex
graphs that are used then LGTM

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171118/7c673aab/attachment.sig>


More information about the ffmpeg-devel mailing list