diff mbox series

[FFmpeg-devel,27/36] fftools/ffmpeg: move a block to a more appropriate place

Message ID 20230517102029.541-27-anton@khirnov.net
State Accepted
Commit b5beff3f15bdb2ac6d3efe41defc0f030c3f08fe
Headers show
Series [FFmpeg-devel,01/36] fftools/ffmpeg: shorten a variable name | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed

Commit Message

Anton Khirnov May 17, 2023, 10:20 a.m. UTC
New placement requires fewer explicit conditions and is easier to
understand.
The logic should be exactly equivalent, since this is the only place
where eof_reached is set for decoding.
---
 fftools/ffmpeg.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 2e9a2b940a..4cf8b54dc0 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1393,6 +1393,16 @@  static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
         }
 
         if (ret == AVERROR_EOF) {
+            /* after flushing, send an EOF on all the filter inputs attached to the stream */
+            /* except when looping we need to flush but not to send an EOF */
+            if (!no_eof) {
+                ret = send_filter_eof(ist);
+                if (ret < 0) {
+                    av_log(NULL, AV_LOG_FATAL, "Error marking filters as finished\n");
+                    exit_program(1);
+                }
+            }
+
             eof_reached = 1;
             break;
         }
@@ -1416,16 +1426,6 @@  static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
         repeating = 1;
     }
 
-    /* after flushing, send an EOF on all the filter inputs attached to the stream */
-    /* except when looping we need to flush but not to send an EOF */
-    if (!pkt && ist->decoding_needed && eof_reached && !no_eof) {
-        int ret = send_filter_eof(ist);
-        if (ret < 0) {
-            av_log(NULL, AV_LOG_FATAL, "Error marking filters as finished\n");
-            exit_program(1);
-        }
-    }
-
     if (!pkt && !ist->decoding_needed)
         eof_reached = 1;