[FFmpeg-cvslog] avfilter/af_headphone: Combine several loops when checking for EOF

Andreas Rheinhardt git at videolan.org
Wed Sep 9 15:59:47 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Fri Aug 28 14:49:49 2020 +0200| [a84c77396bf17dc12925f1c5e25851df55660162] | committer: Andreas Rheinhardt

avfilter/af_headphone: Combine several loops when checking for EOF

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavfilter/af_headphone.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
index 42adc82df8..c71f43c5c8 100644
--- a/libavfilter/af_headphone.c
+++ b/libavfilter/af_headphone.c
@@ -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) {



More information about the ffmpeg-cvslog mailing list