[FFmpeg-cvslog] aacenc: make sure to encode enough frames to cover all input samples.

Justin Ruggles git at videolan.org
Tue Jan 31 03:36:09 CET 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sat Jan 28 17:51:22 2012 -0500| [89eea6df281f535849055f9ce0e49b36eeef767a] | committer: Justin Ruggles

aacenc: make sure to encode enough frames to cover all input samples.

Currently, any samples in the final frame are not decoded because they are
only represented by one frame instead of two. So we encode two final frames to
cover both the analysis delay and the MDCT delay.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=89eea6df281f535849055f9ce0e49b36eeef767a
---

 libavcodec/aacenc.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 5125bd6..97ebbe6 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -510,14 +510,12 @@ static int aac_encode_frame(AVCodecContext *avctx,
     int chan_el_counter[4];
     FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
 
-    if (s->last_frame)
+    if (s->last_frame == 2)
         return 0;
 
-    if (data) {
-        deinterleave_input_samples(s, data, avctx->frame_size);
-        if (s->psypp)
-            ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
-    }
+    deinterleave_input_samples(s, data, data ? avctx->frame_size : 0);
+    if (s->psypp)
+        ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
 
     if (!avctx->frame_number)
         return 0;
@@ -648,7 +646,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
     }
 
     if (!data)
-        s->last_frame = 1;
+        s->last_frame++;
 
     return put_bits_count(&s->pb)>>3;
 }



More information about the ffmpeg-cvslog mailing list