diff mbox

[FFmpeg-devel] ffmpeg: flush_encoders should not treat avcodec_send_frame return AVERROR_EOF as fatal

Message ID 20181019122736.26032-1-jay@wizardofthenet.com
State New
Headers show

Commit Message

jay@wizardofthenet.com Oct. 19, 2018, 12:27 p.m. UTC
this fixes AV_CODEC_CAP_DELAY encoders going into FATAL error and exiting on quit or finish encoding once they go into draining mode and send_frame() returns AVERROR_EOF

Signed-off-by: Jason Stevens <jay@wizardofthenet.com>
---
 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Oct. 19, 2018, 6:25 p.m. UTC | #1
2018-10-19 14:27 GMT+02:00, Jason Stevens <jay@wizardofthenet.com>:
> this fixes AV_CODEC_CAP_DELAY encoders going into FATAL error
> and exiting on quit or finish encoding once they go into draining mode
> and send_frame() returns AVERROR_EOF

Could you provide a command line / sample that triggers this issue?

Carl Eugen
diff mbox

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index da4259a9a8..f30ed946c0 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1939,7 +1939,7 @@  static void flush_encoders(void)
 
                 while ((ret = avcodec_receive_packet(enc, &pkt)) == AVERROR(EAGAIN)) {
                     ret = avcodec_send_frame(enc, NULL);
-                    if (ret < 0) {
+                    if (ret < 0 && ret != AVERROR_EOF) {
                         av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n",
                                desc,
                                av_err2str(ret));