[BE] Resolve "Error reading ISM metadata files"
Basic Info
- Related issues: #786 (closed), MR !1063 (merged)
- Requested reviewers: @norvell
Reason why this change is needed
The encoder crashes when reading past the last line of the ltv48_1ISM.csv
or any other .csv
metadata file.
Error (File read error) while reading ism metadata from: ./ltvISM1.csv
The crash can be reproduced with:
./IVAS_cod -ISM 1 ltvISM1.csv 13200 48 ltv48_MONO.wav bit
The reason is that the function feof()
becomes true ONLY when reading past the end of data which doesn't occur in our codec due to the above error being raised.
Description of the change
This MR fixes the problem with a smarter logic around fgets()
in combination with feof()
. When the last line is read from the .csv
file the file is rewound with the first line to be read again in the next frame.
Affected operating points
This change is BE at all operation points except for ISM input where short .csv
(metadata) files are read from the command-line.