[FFmpeg-devel] [PATCH V1] libavcodec/aacdec: fix HE-AAC decoder dirty date (for sbr) when flush

Jun Zhao mypopydev at gmail.com
Wed Jan 1 07:34:39 EET 2020


From: qoroliang <qoroliang at tencent.com>

aac decoder only do the window overlapping data buffer flush but
without sbr related buffer flush, that will cause dirty data in
the first output frame after flush.

Signed-off-by: qoroliang <qoroliang at tencent.com>
---
 libavcodec/aacdec_template.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index bb11de3..8f8dc24 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -507,7 +507,13 @@ static void flush(AVCodecContext *avctx)
             ChannelElement *che = ac->che[type][i];
             if (che) {
                 for (j = 0; j <= 1; j++) {
+                    // LTP buffer related data buffer
+                    // or windowing overlapping
                     memset(che->ch[j].saved, 0, sizeof(che->ch[j].saved));
+                    memset(che->ch[j].coeffs, 0, sizeof(che->ch[j].coeffs));
+                    // sbr context should be reseted and function pointers should be applied too
+                    memset(&che->sbr, 0, sizeof(che->sbr));
+                    AAC_RENAME(ff_aac_sbr_ctx_init)(ac, &che->sbr, type);
                 }
             }
         }
-- 
1.7.1



More information about the ffmpeg-devel mailing list