From ab052fada03e6f024eb9f75cfba85b7097a712d5 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 31 Aug 2018 15:45:42 +0300 Subject: Adjust the aac-enc.c encoding example to fix flushing the encoder with FDKv2 Even with numInSamples == -1, all the buffer pointers need to be non-null. --- aac-enc.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/aac-enc.c b/aac-enc.c index e773700..c90ff12 100644 --- a/aac-enc.c +++ b/aac-enc.c @@ -196,20 +196,17 @@ int main(int argc, char *argv[]) { const uint8_t* in = &input_buf[2*i]; convert_buf[i] = in[0] | (in[1] << 8); } - if (read <= 0) { - in_args.numInSamples = -1; - } else { - in_ptr = convert_buf; - in_size = read; - in_elem_size = 2; + in_ptr = convert_buf; + in_size = read; + in_elem_size = 2; + + in_args.numInSamples = read <= 0 ? -1 : read/2; + in_buf.numBufs = 1; + in_buf.bufs = &in_ptr; + in_buf.bufferIdentifiers = &in_identifier; + in_buf.bufSizes = &in_size; + in_buf.bufElSizes = &in_elem_size; - in_args.numInSamples = read/2; - in_buf.numBufs = 1; - in_buf.bufs = &in_ptr; - in_buf.bufferIdentifiers = &in_identifier; - in_buf.bufSizes = &in_size; - in_buf.bufElSizes = &in_elem_size; - } out_ptr = outbuf; out_size = sizeof(outbuf); out_elem_size = 1; -- cgit v1.2.3