mpeg4videoenc: ensure SAR is within the supported range
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 30 Jul 2012 23:57:18 +0000 (01:57 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 30 Jul 2012 23:57:18 +0000 (01:57 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpeg4videoenc.c

index e073746..cbf84b7 100644 (file)
@@ -969,6 +969,8 @@ static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_n
 
     put_bits(&s->pb, 4, s->aspect_ratio_info);/* aspect ratio info */
     if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){
+        av_reduce(&s->avctx->sample_aspect_ratio.num, &s->avctx->sample_aspect_ratio.den,
+                   s->avctx->sample_aspect_ratio.num,  s->avctx->sample_aspect_ratio.den, 255);
         put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num);
         put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den);
     }