mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
Merge pull request #465 from alibaba-damo-academy/dev_audio
Update audio.cpp
This commit is contained in:
commit
83641f8a0b
@ -238,6 +238,15 @@ bool Audio::LoadWav(const char *filename, int32_t* sampling_rate)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!header.Validate()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
header.SeekToDataChunk(is);
|
||||
if (!is) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*sampling_rate = header.sample_rate;
|
||||
// header.subchunk2_size contains the number of bytes in the data.
|
||||
// As we assume each sample contains two bytes, so it is divided by 2 here
|
||||
@ -519,4 +528,4 @@ void Audio::Split(Model* recog_obj)
|
||||
frame_queue.push(frame);
|
||||
frame = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user