Commit b20fa8ad authored by Daniel Povey's avatar Daniel Povey
Browse files

Fix to wave-reading code to read wav's with odd number of samples.

parent 4b4ad10a
......@@ -220,7 +220,10 @@ void WaveData::Read(std::istream &is) {
uint32 data_chunk_size = ReadUint32(is, swap);
riff_chunk_read += 4;
if (riff_chunk_read + data_chunk_size != riff_chunk_size) {
if (std::abs((riff_chunk_read + data_chunk_size) - riff_chunk_size) > 1) {
// we allow the size to be off by one, because there is a weirdness in the
// format of RIFF files that means that the input may sometimes be padded
// with 1 unused byte to make the total size even.
KALDI_ERR << "Expected " << riff_chunk_size << " bytes in RIFF chunk, but "
<< "after first data block there will be " << riff_chunk_read
<< " + " << data_chunk_size << " bytes "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment