[FFmpeg-cvslog] avfilter/vf_zscale: properly check return value of slice threads

Marton Balint git at videolan.org
Wed Mar 16 21:23:10 EET 2022


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Mon Mar 14 21:02:18 2022 +0100| [d5722d578e6dd713c2b81536c23151044e0eb96f] | committer: Marton Balint

avfilter/vf_zscale: properly check return value of slice threads

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5722d578e6dd713c2b81536c23151044e0eb96f
---

 libavfilter/vf_zscale.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index bab87b0c94..ceefc95224 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -117,6 +117,7 @@ typedef struct ZScaleContext {
 
     void *tmp[MAX_THREADS]; //separate for each thread;
     int nb_threads;
+    int jobs_ret[MAX_THREADS];
 
     zimg_image_format src_format, dst_format;
     zimg_image_format alpha_src_format, alpha_dst_format;
@@ -858,12 +859,14 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
         td.desc = desc;
         td.odesc = odesc;
 
-        ret = ff_filter_execute(ctx, filter_slice, &td, NULL, s->nb_threads);
-        if (ret < 0 || !s->graph[0]) {
+        memset(s->jobs_ret, 0, s->nb_threads * sizeof(*s->jobs_ret));
+        ret = ff_filter_execute(ctx, filter_slice, &td, s->jobs_ret, s->nb_threads);
+        for (int i = 0; ret >= 0 && i < s->nb_threads; i++)
+            if (s->jobs_ret[i] < 0)
+                ret = s->jobs_ret[i];
+        if (ret < 0) {
             av_frame_free(&in);
             av_frame_free(&out);
-            if (ret >= 0)
-                ret = AVERROR(EINVAL);
             return ret;
         }
 



More information about the ffmpeg-cvslog mailing list