This commit is contained in:
Sean Owen 2021-09-04 08:46:11 -05:00
parent 5b0036446e
commit aeeec7b07f

View file

@ -179,8 +179,9 @@ final class DecodedBitStreamParser {
for (int i = 0; i < NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {
segmentIndexArray[i] = codewords[codeIndex];
}
resultMetadata.setSegmentIndex(Integer.parseInt(decodeBase900toBase10(segmentIndexArray,
NUMBER_OF_SEQUENCE_CODEWORDS)));
String segmentIndexString = decodeBase900toBase10(segmentIndexArray, NUMBER_OF_SEQUENCE_CODEWORDS);
int segmentIndex = segmentIndexString.isEmpty() ? 0 : Integer.parseInt(segmentIndexString);
resultMetadata.setSegmentIndex(segmentIndex);
// Decoding the fileId codewords as 0-899 numbers, each 0-filled to width 3. This follows the spec
// (See ISO/IEC 15438:2015 Annex H.6) and preserves all info, but some generators (e.g. TEC-IT) write