From 4fbc97cc479704a5e12d2d3c0d2b782cf21595a3 Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Fri, 17 Apr 2020 15:10:17 +0200 Subject: [PATCH] Fix input buffer flushing for PS encoder. Bug 177604812 Test: see PS/SBR encoder Change-Id: I3152bd7db5e039ecc54885e5b58c1cf6cb598b28 --- libAACenc/src/aacenc_lib.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp index 3bfdfe8..0217641 100644 --- a/libAACenc/src/aacenc_lib.cpp +++ b/libAACenc/src/aacenc_lib.cpp @@ -1827,12 +1827,13 @@ AACENC_ERROR aacEncEncode(const HANDLE_AACENCODER hAacEncoder, /* clear out until end-of-buffer */ if (nZeros) { + INT_PCM *pIn = + hAacEncoder->inputBuffer + + hAacEncoder->inputBufferOffset / + hAacEncoder->aacConfig.nChannels + + hAacEncoder->nSamplesRead / hAacEncoder->extParam.nChannels; for (i = 0; i < (int)hAacEncoder->extParam.nChannels; i++) { - FDKmemclear(hAacEncoder->inputBuffer + - i * hAacEncoder->inputBufferSizePerChannel + - (hAacEncoder->inputBufferOffset + - hAacEncoder->nSamplesRead) / - hAacEncoder->extParam.nChannels, + FDKmemclear(pIn + i * hAacEncoder->inputBufferSizePerChannel, sizeof(INT_PCM) * nZeros); } hAacEncoder->nZerosAppended += nZeros;