fix catch for vad

This commit is contained in:
雾聪 2023-08-09 22:26:03 +08:00
parent ec0e75ea8b
commit 268adb8c1e
3 changed files with 6 additions and 3 deletions

View File

@ -140,6 +140,9 @@ FsmnVadOnline::Infer(std::vector<float> &waves, bool input_finished) {
return vad_segments;
}
fsmnvad_handle_->Forward(vad_feats, &vad_probs, &in_cache_, input_finished);
if(vad_probs.size() == 0){
return vad_segments;
}
vad_segments = vad_scorer(vad_probs, waves, input_finished, true, vad_silence_duration_, vad_max_len_,
vad_speech_noise_thres_, vad_sample_rate_);

View File

@ -148,7 +148,7 @@ void FsmnVad::Forward(
vad_inputs.size(), vad_out_names_.data(), vad_out_names_.size());
} catch (std::exception const &e) {
LOG(ERROR) << "Error when run vad onnx forword: " << (e.what());
exit(-1);
return;
}
// 5. Change infer result to output shapes

View File

@ -34,9 +34,9 @@
*/
void WaitABit() {
#ifdef WIN32
Sleep(300);
Sleep(500);
#else
usleep(300);
usleep(500);
#endif
}
std::atomic<int> wav_index(0);