Avoid an infinite 'retry' loop in output_packet when flushing. Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris> --- libavformat/mpegenc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index e0955a7d33..91574ca95a 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -85,6 +85,7 @@ typedef struct MpegMuxContext { int preload; int fifo_size_limit; + int fifo_size_exceeded; } MpegMuxContext; extern const AVOutputFormat ff_mpeg1vcd_muxer; @@ -1221,9 +1222,11 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) } ret = av_fifo_write(stream->fifo, buf, size); - if (ret == AVERROR(ENOSPC)) + if (ret == AVERROR(ENOSPC)) { + s->fifo_size_exceeded = 1; av_log(s, AV_LOG_FATAL, "Input stream buffer overrun. " "To avoid, increase fifo_size_limit option.\n"); + } if (ret < 0) return ret; @@ -1236,9 +1239,13 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) static int mpeg_mux_end(AVFormatContext *ctx) { + MpegMuxContext *s = ctx->priv_data; StreamInfo *stream; int i; + if (s->fifo_size_exceeded) + return 0; + for (;;) { int ret = output_packet(ctx, 1); if (ret < 0) -- 2.34.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".