always re-allocate aac codec between tracks - release

This commit is contained in:
Philippe G
2020-05-15 20:50:36 -07:00
parent c33635f35c
commit e04708ad1c
2 changed files with 7 additions and 3 deletions

Binary file not shown.

View File

@@ -572,13 +572,15 @@ static void helixaac_open(u8_t size, u8_t rate, u8_t chan, u8_t endianness) {
a->type = size; a->type = size;
a->pos = a->consume = a->sample = a->nextchunk = 0; a->pos = a->consume = a->sample = a->nextchunk = 0;
if (a->chunkinfo) { if (a->chunkinfo) {
free(a->chunkinfo); free(a->chunkinfo);
} }
if (a->stsc) { if (a->stsc) {
free(a->stsc); free(a->stsc);
} }
a->chunkinfo = NULL; a->chunkinfo = NULL;
a->stsc = NULL; a->stsc = NULL;
a->skip = 0; a->skip = 0;
@@ -587,12 +589,14 @@ static void helixaac_open(u8_t size, u8_t rate, u8_t chan, u8_t endianness) {
a->empty = false; a->empty = false;
if (a->hAac) { if (a->hAac) {
HAAC(a, FlushCodec, a->hAac); // always free decoder as flush only works when no parameter has changed
HAAC(a, FreeDecoder, a->hAac);
} else { } else {
a->hAac = HAAC(a, InitDecoder);
a->write_buf = malloc(FRAME_BUF * BYTES_PER_FRAME); a->write_buf = malloc(FRAME_BUF * BYTES_PER_FRAME);
a->wrap_buf = malloc(WRAPBUF_LEN); a->wrap_buf = malloc(WRAPBUF_LEN);
} }
a->hAac = HAAC(a, InitDecoder);
} }
static void helixaac_close(void) { static void helixaac_close(void) {