Skip to content

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

json stamp_sents for websocket-server

雾聪2acef4bdaea5
diff --git a/runtime/websocket/bin/websocket-server.cpp b/runtime/websocket/bin/websocket-server.cpp
index 97d6c4718..026954fca 100644
--- a/runtime/websocket/bin/websocket-server.cpp
+++ b/runtime/websocket/bin/websocket-server.cpp
@@ -100,7 +100,14 @@ void WebSocketServer::do_decoder(const std::vector<char>& buffer,
jsonresult["timestamp"] = stamp_res;
}
if(stamp_sents != ""){
- jsonresult["stamp_sents"] = stamp_sents;
+ try{
+ nlohmann::json json_stamp = nlohmann::json::parse(stamp_sents);
+ jsonresult["stamp_sents"] = json_stamp;
+ }catch (std::exception const &e)
+ {
+ LOG(ERROR)<<e.what();
+ jsonresult["stamp_sents"] = "";
+ }
}
jsonresult["wav_name"] = wav_name;