]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/af_headphone: Combine several loops when checking for EOF
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 28 Aug 2020 12:49:49 +0000 (14:49 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 9 Sep 2020 11:46:18 +0000 (13:46 +0200)
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavfilter/af_headphone.c

index 42adc82df84dbb9cfe40855d1bb877d05bb680c2..c71f43c5c805dfde971c3d8d21423cc0bd5d38a2 100644 (file)
@@ -633,6 +633,7 @@ static int activate(AVFilterContext *ctx)
 
     FF_FILTER_FORWARD_STATUS_BACK_ALL(ctx->outputs[0], ctx);
     if (!s->eof_hrirs) {
+        int eof = 1;
         for (i = 1; i < s->nb_inputs; i++) {
             if (s->in[i].eof)
                 continue;
@@ -647,26 +648,15 @@ static int activate(AVFilterContext *ctx)
                     return AVERROR_INVALIDDATA;
                 }
                     s->in[i].eof = 1;
+            } else {
+                if (ff_outlink_frame_wanted(ctx->outputs[0]))
+                    ff_inlink_request_frame(ctx->inputs[i]);
+                eof = 0;
             }
         }
-
-        for (i = 1; i < s->nb_inputs; i++) {
-            if (!s->in[i].eof)
-                break;
-        }
-
-        if (i != s->nb_inputs) {
-            if (ff_outlink_frame_wanted(ctx->outputs[0])) {
-                for (i = 1; i < s->nb_inputs; i++) {
-                    if (!s->in[i].eof)
-                        ff_inlink_request_frame(ctx->inputs[i]);
-                }
-            }
-
+        if (!eof)
             return 0;
-        } else {
-            s->eof_hrirs = 1;
-        }
+        s->eof_hrirs = 1;
     }
 
     if (!s->have_hrirs && s->eof_hrirs) {