[FFmpeg-cvslog] avformat/mpegenc: check, warn and clip muxrate to syntactical possible values

Michael Niedermayer git at videolan.org
Sun Sep 29 17:09:18 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Sep 29 17:02:57 2013 +0200| [f2eb474a5a3d0ff1f1c5fbdfb8e9a1abe5661bce] | committer: Michael Niedermayer

avformat/mpegenc: check, warn and clip muxrate to syntactical possible values

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/mpegenc.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 6e94f9d..0a9d69b 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -428,6 +428,10 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
         bitrate += bitrate / 20;
         bitrate += 10000;
         s->mux_rate = (bitrate + (8 * 50) - 1) / (8 * 50);
+        if (s->mux_rate >= (1<<22)) {
+            av_log(ctx, AV_LOG_WARNING, "mux rate %d is too large\n", s->mux_rate);
+            s->mux_rate = (1<<22) - 1;
+        }
     }
 
     if (s->is_vcd) {



More information about the ffmpeg-cvslog mailing list