From 81acb17544a05424dff0ef74f3aeb2ce9866ba6a Mon Sep 17 00:00:00 2001
From: zhifu gao <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 06 十二月 2023 19:54:37 +0800
Subject: [PATCH] update with main (#1152)

---
 runtime/websocket/bin/websocket-server.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/runtime/websocket/bin/websocket-server.cpp b/runtime/websocket/bin/websocket-server.cpp
index 6ba4537..99b150f 100644
--- a/runtime/websocket/bin/websocket-server.cpp
+++ b/runtime/websocket/bin/websocket-server.cpp
@@ -68,7 +68,6 @@
                                  int audio_fs,
                                  std::string wav_format,
                                  FUNASR_DEC_HANDLE& decoder_handle) {
-  scoped_lock guard(thread_lock);
   try {
     int num_samples = buffer.size();  // the size of the buf
 
@@ -130,6 +129,7 @@
   } catch (std::exception const& e) {
     std::cerr << "Error: " << e.what() << std::endl;
   }
+  scoped_lock guard(thread_lock);
   msg["access_num"]=(int)msg["access_num"]-1;
 }
 
@@ -343,7 +343,9 @@
         msg_data->msg["itn"] = jsonresult["itn"];
       }
       if ((jsonresult["is_speaking"] == false ||
-          jsonresult["is_finished"] == true) && msg_data->msg["is_eof"] != true) {
+          jsonresult["is_finished"] == true) && 
+          msg_data->msg["is_eof"] != true && 
+          msg_data->hotwords_embedding != NULL) {
         LOG(INFO) << "client done";
         // for offline, send all receive data to decoder engine
         std::vector<std::vector<float>> hotwords_embedding_(*(msg_data->hotwords_embedding));

--
Gitblit v1.9.1