[FFmpeg-cvslog] avcodec/mpegvideo_parser: more robust dimension setup

Michael Niedermayer git at videolan.org
Sun Jan 18 05:14:39 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jan 18 04:39:41 2015 +0100| [741fa0493b94946d4b9bae37e9f4270766f74534] | committer: Michael Niedermayer

avcodec/mpegvideo_parser: more robust dimension setup

Before this missing seq headers could have led to wrong dimensions

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

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

 libavcodec/mpegvideo_parser.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index 0159421..8196eca 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -90,8 +90,8 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
                         pc->progressive_sequence = buf[1] & (1 << 3);
                         avctx->has_b_frames= !(buf[5] >> 7);
 
-                        pc->width  |=(horiz_size_ext << 12);
-                        pc->height |=( vert_size_ext << 12);
+                        pc->width  = (pc->width & 0xFFF) | (horiz_size_ext << 12);
+                        pc->height = (pc->height& 0xFFF) | ( vert_size_ext << 12);
                         bit_rate = (bit_rate&0x3FFFF) | (bit_rate_ext << 18);
                         if(did_set_size)
                             ff_set_dimensions(avctx, pc->width, pc->height);



More information about the ffmpeg-cvslog mailing list