X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Faac_ac3_parser.c;h=e84d30aea22ff74963892b997d1939746c8861db;hb=bc70684e74a185d7b80c8b80bdedda659cb581b8;hp=54e459844f141c8c176ac64a2be4b360a4c4f56b;hpb=22219a3ac46ac18f797c94e4619a34728556786c;p=ffmpeg diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c index 54e459844f1..e84d30aea22 100644 --- a/libavcodec/aac_ac3_parser.c +++ b/libavcodec/aac_ac3_parser.c @@ -89,7 +89,7 @@ get_next: the frame). */ if (avctx->codec_id != AV_CODEC_ID_AAC) { avctx->sample_rate = s->sample_rate; - if (avctx->codec_id != AV_CODEC_ID_EAC3) { + if (!CONFIG_EAC3_DECODER || avctx->codec_id != AV_CODEC_ID_EAC3) { avctx->channels = s->channels; avctx->channel_layout = s->channel_layout; } @@ -97,8 +97,12 @@ get_next: avctx->audio_service_type = s->service_type; } - if (avctx->codec_id != AV_CODEC_ID_EAC3) - avctx->bit_rate = s->bit_rate; + /* Calculate the average bit rate */ + s->frame_number++; + if (!CONFIG_EAC3_DECODER || avctx->codec_id != AV_CODEC_ID_EAC3) { + avctx->bit_rate += + (s->bit_rate - avctx->bit_rate) / s->frame_number; + } } return i;