diff mbox series

[FFmpeg-devel,02/10] ffmpeg_filter: do not override -filter_threads with -threads

Message ID 20210808172941.18238-2-anton@khirnov.net
State Accepted
Commit 834b8ad8a39b77105951f30dc73c6a203afca817
Headers show
Series [FFmpeg-devel,01/10] ffmpeg: reset the dict iterator before use | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Anton Khirnov Aug. 8, 2021, 5:29 p.m. UTC
When both -filter_threads and -threads are specified, the latter takes
effect. Since -threads is an encoder option and -filter_threads is a
filter option, it makes sense for the -filter_threads to take
precedence.
---
 fftools/ffmpeg_filter.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Paul B Mahol Aug. 8, 2021, 5:35 p.m. UTC | #1
lgtm
diff mbox series

Patch

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index b252ee4138..2b1b06268b 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -969,6 +969,11 @@  int configure_filtergraph(FilterGraph *fg)
         AVDictionaryEntry *e = NULL;
 
         fg->graph->nb_threads = filter_nbthreads;
+        if (!fg->graph->nb_threads) {
+            e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
+            if (e)
+                av_opt_set(fg->graph, "threads", e->value, 0);
+        }
 
         args[0] = 0;
         e       = NULL;
@@ -1001,10 +1006,6 @@  int configure_filtergraph(FilterGraph *fg)
         }
         if (strlen(args))
             args[strlen(args) - 1] = '\0';
-
-        e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
-        if (e)
-            av_opt_set(fg->graph, "threads", e->value, 0);
     } else {
         fg->graph->nb_threads = filter_complex_nbthreads;
     }