From: Nicolas Gaullier <nicolas.gaullier@cji.paris>
To: ffmpeg-devel@ffmpeg.org
Cc: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Subject: [FFmpeg-devel] [PATCH v4 2/2] lavf/mpegenc: fix termination following a fifo overrun
Date: Tue, 22 Mar 2022 18:23:37 +0100
Message-ID: <20220322172337.65005-2-nicolas.gaullier@cji.paris> (raw)
In-Reply-To: <20220322172337.65005-1-nicolas.gaullier@cji.paris>
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-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2022-03-22 17:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-22 17:23 [FFmpeg-devel] [PATCH v4 1/2] lavf/mpegenc: fix ever-growing fifo size since the new API Nicolas Gaullier
2022-03-22 17:23 ` Nicolas Gaullier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220322172337.65005-2-nicolas.gaullier@cji.paris \
--to=nicolas.gaullier@cji.paris \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git