From f479f94832ce6ca0d381ed3d8e53675dea24a6ec Mon Sep 17 00:00:00 2001
From: 北念 <lzr265946@alibaba-inc.com>
Date: 星期四, 02 十一月 2023 16:35:10 +0800
Subject: [PATCH] fix paraformer-16k-en finetune pipeline
---
funasr/runtime/websocket/bin/websocket-server-2pass.cpp | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/funasr/runtime/websocket/bin/websocket-server-2pass.cpp b/funasr/runtime/websocket/bin/websocket-server-2pass.cpp
index b64cecb..a637471 100644
--- a/funasr/runtime/websocket/bin/websocket-server-2pass.cpp
+++ b/funasr/runtime/websocket/bin/websocket-server-2pass.cpp
@@ -356,7 +356,14 @@
unique_lock guard_decoder(*(thread_lock_p)); // mutex for one connection
switch (msg->get_opcode()) {
case websocketpp::frame::opcode::text: {
- nlohmann::json jsonresult = nlohmann::json::parse(payload);
+ nlohmann::json jsonresult;
+ try{
+ jsonresult = nlohmann::json::parse(payload);
+ }catch (std::exception const &e)
+ {
+ LOG(ERROR)<<e.what();
+ break;
+ }
if (jsonresult.contains("wav_name")) {
msg_data->msg["wav_name"] = jsonresult["wav_name"];
@@ -401,9 +408,15 @@
if (msg_data->tpass_online_handle == NULL) {
std::vector<int> chunk_size_vec =
jsonresult["chunk_size"].get<std::vector<int>>();
- FUNASR_HANDLE tpass_online_handle =
- FunTpassOnlineInit(tpass_handle, chunk_size_vec);
- msg_data->tpass_online_handle = tpass_online_handle;
+ // check chunk_size_vec
+ if(chunk_size_vec.size() == 3 && chunk_size_vec[1] != 0){
+ FUNASR_HANDLE tpass_online_handle =
+ FunTpassOnlineInit(tpass_handle, chunk_size_vec);
+ msg_data->tpass_online_handle = tpass_online_handle;
+ }else{
+ LOG(ERROR) << "Wrong chunk_size!";
+ break;
+ }
}
}
if (jsonresult.contains("itn")) {
--
Gitblit v1.9.1