[FFmpeg-cvslog] fftools/ffmpeg_filter: only flush vsync code if encoding actually started

Anton Khirnov git at videolan.org
Sat Jul 15 12:03:18 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Jul  7 09:29:58 2023 +0200| [b295ec31f351d8cc2dfad6f7c0cb261c1b19b7d9] | committer: Anton Khirnov

fftools/ffmpeg_filter: only flush vsync code if encoding actually started

Otherwise this has no effect.

Will be useful in following commits.

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

 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 1b51ed55bd..1ca9728390 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1754,10 +1754,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) {



More information about the ffmpeg-cvslog mailing list