Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

fix catch for vad

雾聪268adb8c1eaf
diff --git a/funasr/runtime/onnxruntime/src/fsmn-vad-online.cpp b/funasr/runtime/onnxruntime/src/fsmn-vad-online.cpp
index 58bda621d..b9cda4bd3 100644
--- a/funasr/runtime/onnxruntime/src/fsmn-vad-online.cpp
+++ b/funasr/runtime/onnxruntime/src/fsmn-vad-online.cpp
@@ -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_);
diff --git a/funasr/runtime/onnxruntime/src/fsmn-vad.cpp b/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
index 8ba09c76b..50a9a0357 100644
--- a/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
+++ b/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
@@ -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
diff --git a/funasr/runtime/websocket/funasr-wss-client-2pass.cpp b/funasr/runtime/websocket/funasr-wss-client-2pass.cpp
index 48e9079bd..c3c3dc88a 100644
--- a/funasr/runtime/websocket/funasr-wss-client-2pass.cpp
+++ b/funasr/runtime/websocket/funasr-wss-client-2pass.cpp
@@ -34,9 +34,9 @@
*/
void WaitABit() {
#ifdef WIN32
- Sleep(300);
+ Sleep(500);
#else
- usleep(300);
+ usleep(500);
#endif
}
std::atomic<int> wav_index(0);