diff mbox series

[FFmpeg-devel,04/12] ffools/ffmpeg_filter: stop trying to handle an unreachable state

Message ID 20231003153526.19228-4-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/12] fftools/ffmpeg_enc: move handling video frame duration to video_sync_process() | expand

Checks

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

Commit Message

Anton Khirnov Oct. 3, 2023, 3:35 p.m. UTC
ifilter_send_eof() will fail if the input has no real or fallback
parameters, so there is no need to handle the case of some inputs being
in EOF state yet having no parameters.
---
 fftools/ffmpeg.c        |  2 +-
 fftools/ffmpeg.h        |  2 --
 fftools/ffmpeg_filter.c | 10 +++++-----
 3 files changed, 6 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index fd2ce1c2d0..14f55cbec7 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -944,7 +944,7 @@  static int choose_output(OutputStream **post)
                    INT64_MIN : ost->last_mux_dts;
         }
 
-        if (!ost->initialized && !ost->inputs_done && !ost->finished) {
+        if (!ost->initialized && !ost->finished) {
             ost_min = ost;
             break;
         }
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index b059ecbb9f..2e8f1db9b6 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -583,8 +583,6 @@  typedef struct OutputStream {
     // parameters are set in the AVStream.
     int initialized;
 
-    int inputs_done;
-
     const char *attachment_filename;
 
     int keep_pix_fmt;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index b6348d7f87..804b9de3dc 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -2076,11 +2076,11 @@  int fg_transcode_step(FilterGraph *graph, InputStream **best_ist)
             }
         }
 
-        // graph not configured, but all inputs are either initialized or EOF
-        for (int i = 0; i < graph->nb_outputs; i++)
-            graph->outputs[i]->ost->inputs_done = 1;
-
-        return 0;
+        // This state - graph is not configured, but all inputs are either
+        // initialized or EOF - should be unreachable because sending EOF to a
+        // filter without even a fallback format should fail
+        av_assert0(0);
+        return AVERROR_BUG;
     }
 
     *best_ist = NULL;