From d9b56895b5812e59ebda42b7d8ce221bd50f9f03 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 2 Sep 2015 21:02:31 +0200 Subject: [PATCH] avcodec/mpegvideo: change bit_rate to 64bit 32bit is not sufficient for all cases Fixes: signal_sigabrt_7ffff6ac8cc9_686_cov_1897408623_microsoft_new_way_to_shove_mpeg2_in_asf.dvr_ms Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/mpeg12dec.c | 4 ++-- libavcodec/mpegvideo.h | 2 +- libavcodec/msmpeg4dec.c | 2 +- libavcodec/msmpeg4enc.c | 2 +- libavcodec/ratecontrol.c | 6 +++--- libavcodec/wmv2dec.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 53ad186875..40600d9eb8 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1506,7 +1506,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1) if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_DEBUG, - "profile: %d, level: %d ps: %d cf:%d vbv buffer: %d, bitrate:%d\n", + "profile: %d, level: %d ps: %d cf:%d vbv buffer: %d, bitrate:%"PRId64"\n", s->avctx->profile, s->avctx->level, s->progressive_sequence, s->chroma_format, s->avctx->rc_buffer_size, s->bit_rate); } @@ -2228,7 +2228,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, s->low_delay = 1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) - av_log(s->avctx, AV_LOG_DEBUG, "vbv buffer: %d, bitrate:%d, aspect_ratio_info: %d \n", + av_log(s->avctx, AV_LOG_DEBUG, "vbv buffer: %d, bitrate:%"PRId64", aspect_ratio_info: %d \n", s->avctx->rc_buffer_size, s->bit_rate, s->aspect_ratio_info); return 0; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 84920452e4..b47a4f38aa 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -107,7 +107,7 @@ typedef struct MpegEncContext { int width, height;///< picture size. must be a multiple of 16 int gop_size; int intra_only; ///< if true, only intra pictures are generated - int bit_rate; ///< wanted bit rate + int64_t bit_rate; ///< wanted bit rate enum OutputFormat out_format; ///< output format int h263_pred; ///< use mpeg4/h263 ac/dc predictions int pb_frame; ///< PB frame mode (0 = none, 1 = base, 2 = improved) diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index 624946fa38..aaadd9c073 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -541,7 +541,7 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) s->no_rounding = 0; } } - ff_dlog(s->avctx, "%d %d %d %d %d\n", s->pict_type, s->bit_rate, + ff_dlog(s->avctx, "%d %"PRId64" %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height); s->esc3_level_length= 0; diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c index e138f087a2..e1ade248a3 100644 --- a/libavcodec/msmpeg4enc.c +++ b/libavcodec/msmpeg4enc.c @@ -240,7 +240,7 @@ void ff_msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number) s->per_mb_rl_table = 0; if(s->msmpeg4_version==4) s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==AV_PICTURE_TYPE_P); - ff_dlog(s, "%d %d %d %d %d\n", s->pict_type, s->bit_rate, + ff_dlog(s, "%d %"PRId64" %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height); if (s->pict_type == AV_PICTURE_TYPE_I) { diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 989816e689..308e34ee18 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -890,7 +890,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) if (s->avctx->debug & FF_DEBUG_RC) { av_log(s->avctx, AV_LOG_DEBUG, "%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f " - "size:%d var:%"PRId64"/%"PRId64" br:%d fps:%d\n", + "size:%d var:%"PRId64"/%"PRId64" br:%"PRId64" fps:%d\n", av_get_picture_type_char(pict_type), qmin, q, qmax, picture_number, (int)wanted_bits / 1000, (int)s->total_bits / 1000, @@ -1057,9 +1057,9 @@ static int init_pass2(MpegEncContext *s) } av_assert0(toobig <= 40); av_log(s->avctx, AV_LOG_DEBUG, - "[lavc rc] requested bitrate: %d bps expected bitrate: %d bps\n", + "[lavc rc] requested bitrate: %"PRId64" bps expected bitrate: %"PRId64" bps\n", s->bit_rate, - (int)(expected_bits / ((double)all_available_bits / s->bit_rate))); + (int64_t)(expected_bits / ((double)all_available_bits / s->bit_rate))); av_log(s->avctx, AV_LOG_DEBUG, "[lavc rc] estimated target average qp: %.3f\n", (float)qscale_sum / rcc->num_entries); diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index cd17358287..99c95d397a 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -108,7 +108,7 @@ static int decode_ext_header(Wmv2Context *w) if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_DEBUG, - "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, " + "fps:%d, br:%"PRId64", qpbit:%d, abt_flag:%d, j_type_bit:%d, " "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, " "slices:%d\n", fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit,