[FFmpeg-devel] [PATCH 17/22] fftools/ffmpeg_filter: only flush vsync code if encoding actually started

Anton Khirnov anton at khirnov.net
Fri Jul 7 12:48:42 EEST 2023


Otherwise this has no effect.

Will be useful in following commits.
---
 fftools/ffmpeg_filter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index f8e64ce6cc..4955fe38dd 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1720,10 +1720,10 @@ int reap_filters(int flush)
                 if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) {
                     av_log(fgp, AV_LOG_WARNING,
                            "Error in av_buffersink_get_frame_flags(): %s\n", av_err2str(ret));
-                } else if (flush && ret == AVERROR_EOF) {
-                    if (av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO)
-                        enc_frame(ost, NULL);
-                }
+                } else if (flush && ret == AVERROR_EOF && ofp->got_frame &&
+                           av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO)
+                    enc_frame(ost, NULL);
+
                 break;
             }
             if (ost->finished) {
-- 
2.40.1



More information about the ffmpeg-devel mailing list