From 4547cf68a0d28c01549f84567e4d39a8b40230e7 Mon Sep 17 00:00:00 2001 From: Ganesh Ajjanagadde Date: Sun, 12 Jul 2015 10:33:37 -0400 Subject: avformat/isom: utilize bitrate hints Fixes Ticket4546 Signed-off-by: Michael Niedermayer --- libavformat/isom.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libavformat/isom.c') diff --git a/libavformat/isom.c b/libavformat/isom.c index db9129bcac..5673c512b0 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -451,19 +451,24 @@ static const AVCodecTag mp4_audio_types[] = { int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb) { enum AVCodecID codec_id; + unsigned v; int len, tag; int ret; int object_type_id = avio_r8(pb); avio_r8(pb); /* stream type */ avio_rb24(pb); /* buffer size db */ - avio_rb32(pb); /* max bitrate */ - avio_rb32(pb); /* avg bitrate */ if(avcodec_is_open(st->codec)) { av_log(fc, AV_LOG_DEBUG, "codec open in read_dec_config_descr\n"); return -1; } + v = avio_rb32(pb); + if (v < INT32_MAX) + st->codec->rc_max_rate = v; + + st->codec->bit_rate = avio_rb32(pb); /* avg bitrate */ + codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id); if (codec_id) st->codec->codec_id= codec_id; -- cgit v1.2.3