aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-25 21:53:56 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-25 21:53:56 +0200
commitb789f0a4644c0ad1097de976130af15b7c924754 (patch)
treeaf057989a283850ff6e49d102ff2128af4dfbefe
parentceb9dee04ca2bf6337da283fe92fb28e02a7e883 (diff)
downloadODR-AudioEnc-b789f0a4644c0ad1097de976130af15b7c924754.tar.gz
ODR-AudioEnc-b789f0a4644c0ad1097de976130af15b7c924754.tar.bz2
ODR-AudioEnc-b789f0a4644c0ad1097de976130af15b7c924754.zip
Don't insert stale PAD data when the read returns 0
-rw-r--r--src/dabplus-enc.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp
index fc6fa0f..9c00807 100644
--- a/src/dabplus-enc.cpp
+++ b/src/dabplus-enc.cpp
@@ -604,14 +604,17 @@ int main(int argc, char *argv[])
// -------------- AAC Encoding
+ int calculated_padlen = ret > 0 ? padlen : 0;
+
+
in_ptr[0] = input_buf;
in_ptr[1] = pad_buf;
in_size[0] = read;
- in_size[1] = padlen;
+ in_size[1] = calculated_padlen;
in_elem_size[0] = BYTES_PER_SAMPLE;
in_elem_size[1] = sizeof(uint8_t);
in_args.numInSamples = input_size/BYTES_PER_SAMPLE;
- in_args.numAncBytes = padlen;
+ in_args.numAncBytes = calculated_padlen;
in_buf.bufs = (void**)&in_ptr;
in_buf.bufferIdentifiers = in_identifier;