summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r--libavcodec/aacenc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 00261c095e..c247c5b390 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -510,6 +510,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
ChannelElement *cpe;
int i, ch, w, g, chans, tag, start_ch, ret;
int chan_el_counter[4];
+ int frame_bits;
FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
if (s->last_frame == 2)
@@ -577,8 +578,6 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
do {
- int frame_bits;
-
init_put_bits(&s->pb, avpkt->data, avpkt->size);
if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & AV_CODEC_FLAG_BITEXACT))
@@ -651,11 +650,16 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
put_bits(&s->pb, 3, TYPE_END);
flush_put_bits(&s->pb);
- avctx->frame_bits = put_bits_count(&s->pb);
+ frame_bits = put_bits_count(&s->pb);
+#if FF_API_STAT_BITS
+FF_DISABLE_DEPRECATION_WARNINGS
+ avctx->frame_bits = frame_bits;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
// rate control stuff
if (!(avctx->flags & AV_CODEC_FLAG_QSCALE)) {
- float ratio = avctx->bit_rate * 1024.0f / avctx->sample_rate / avctx->frame_bits;
+ float ratio = avctx->bit_rate * 1024.0f / avctx->sample_rate / frame_bits;
s->lambda *= ratio;
s->lambda = FFMIN(s->lambda, 65536.f);
}