mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavc/aac_ac3_parser: fix potential overflow when averaging bitrate
The new code is analog to how it's done in our mpegaudio parser. Acked-by: Jun Zhao <barryjzhao@tencent.com> Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
This commit is contained in:
parent
1201687da2
commit
ecd71916d1
@ -100,9 +100,8 @@ get_next:
|
|||||||
/* Calculate the average bit rate */
|
/* Calculate the average bit rate */
|
||||||
s->frame_number++;
|
s->frame_number++;
|
||||||
if (avctx->codec_id != AV_CODEC_ID_EAC3) {
|
if (avctx->codec_id != AV_CODEC_ID_EAC3) {
|
||||||
avctx->bit_rate =
|
avctx->bit_rate +=
|
||||||
(s->last_bit_rate * (s->frame_number -1) + s->bit_rate)/s->frame_number;
|
(s->bit_rate - avctx->bit_rate) / s->frame_number;
|
||||||
s->last_bit_rate = avctx->bit_rate;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@ typedef struct AACAC3ParseContext {
|
|||||||
|
|
||||||
int need_next_header;
|
int need_next_header;
|
||||||
int frame_number;
|
int frame_number;
|
||||||
int last_bit_rate;
|
|
||||||
enum AVCodecID codec_id;
|
enum AVCodecID codec_id;
|
||||||
} AACAC3ParseContext;
|
} AACAC3ParseContext;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
3e63cbb6bb6ec756d79fab2632fef305 *tests/data/fate/adtstoasc_ticket3715.mov
|
29ef0632a8eb5c336bf45a1d5076626e *tests/data/fate/adtstoasc_ticket3715.mov
|
||||||
33324 tests/data/fate/adtstoasc_ticket3715.mov
|
33324 tests/data/fate/adtstoasc_ticket3715.mov
|
||||||
#extradata 0: 2, 0x00340022
|
#extradata 0: 2, 0x00340022
|
||||||
#tb 0: 1/44100
|
#tb 0: 1/44100
|
||||||
|
Loading…
x
Reference in New Issue
Block a user