diff mbox series

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

Message ID 20230919191044.18873-6-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/27] fftools/ffmpeg: move derivation of frame duration from filter framerate | expand

Commit Message

Anton Khirnov Sept. 19, 2023, 7:10 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;