From 8c1253c9349cd68dfcf95298cef5e42f3be7dc14 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 29 Sep 2013 17:02:06 +0200 Subject: [PATCH] avformat/mpegenc: check, warn and clip VBV value to within syntactically possible values Signed-off-by: Michael Niedermayer --- libavformat/mpegenc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 1a7f64a962..6e94f9dab4 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -379,6 +379,10 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n"); stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default } + if (stream->max_buffer_size > 1024 * 8191) { + av_log(ctx, AV_LOG_WARNING, "buffer size %d, too large\n", stream->max_buffer_size); + stream->max_buffer_size = 1024 * 8191; + } s->video_bound++; break; case AVMEDIA_TYPE_SUBTITLE: