From 176f3aeacec5506ce8c1b91dc844dbcc338d6c57 Mon Sep 17 00:00:00 2001 From: philippe44 Date: Wed, 29 May 2019 23:51:31 -0700 Subject: [PATCH] codec tweak --- main/helix-aac.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main/helix-aac.c b/main/helix-aac.c index 1f71da6f..a9642b71 100644 --- a/main/helix-aac.c +++ b/main/helix-aac.c @@ -359,16 +359,20 @@ static decode_state helixaac_decode(void) { // adts stream - seek for header long n = AACFindSyncWord(streambuf->readp, bytes_wrap); - if (n > 0) { + LOG_DEBUG("Sync search in %d bytes %d", bytes_wrap, n); + + if (n >= 0) { u8_t *p = streambuf->readp + n; int bytes = bytes_wrap - n; - + if (!HAAC(a, Decode, a->hAac, &p, &bytes, (short*) a->write_buf)) { HAAC(a, GetLastFrameInfo, a->hAac, &info); channels = info.nChans; samplerate = info.sampRateOut; found = 1; } + + HAAC(a, FlushCodec, a->hAac); bytes_total -= n; bytes_wrap -= n;