diff options
author | Rostislav Pehlivanov <atomnuker@gmail.com> | 2016-11-07 05:11:50 +0300 |
---|---|---|
committer | Rostislav Pehlivanov <atomnuker@gmail.com> | 2016-11-08 03:50:51 +0300 |
commit | 0cf6853804675c99573889670b3447af4de1a3f3 (patch) | |
tree | b1274ccd7992779f035c7ebd74be3dcb8b4954f9 /libavcodec/aacenc.c | |
parent | ef6a786401f8ad44a6274e4f17c4ae078c5e02b1 (diff) |
aacenc: quit when the audio queue reaches 0 rather than keeping track of empty frames
The libopus encoder does the same thing and its better than
keeping track of when the empty flush frames appear.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r-- | libavcodec/aacenc.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 363ed0537b..956e974cb2 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -520,13 +520,13 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, int chan_el_counter[4]; FFPsyWindowInfo windows[AAC_MAX_CHANNELS]; - if (s->last_frame == 2) - return 0; - /* add current frame to queue */ if (frame) { if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; + } else { + if (!s->afq.remaining_samples || (!s->afq.frame_alloc && !s->afq.frame_count)) + return 0; } copy_input_samples(s, frame); @@ -841,9 +841,6 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, s->lambda_sum += s->lambda; s->lambda_count++; - if (!frame) - s->last_frame++; - ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts, &avpkt->duration); |