雾聪
2023-12-13 de87e1d180d214e1f49682d2b5fb7c9d2c89ae7e
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;
}
@@ -144,7 +144,7 @@
  data_msg->msg["wav_format"] = "pcm";
  data_msg->msg["wav_name"] = "wav-default-id";
  data_msg->msg["itn"] = true;
  data_msg->msg["audio_fs"] = 16000;
  data_msg->msg["audio_fs"] = 16000; // default is 16k
  data_msg->msg["access_num"] = 0; // the number of access for this object, when it is 0, we can free it saftly
  data_msg->msg["is_eof"]=false;
  FUNASR_DEC_HANDLE decoder_handle =
@@ -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));