雾聪
2023-08-10 800b28152bba438c8472eec7571eae10212a0515
funasr/runtime/websocket/websocket-server-2pass.cpp
@@ -320,6 +320,7 @@
        LOG(INFO) << "client done";
        // if it is in final message, post the sample_data to decode
        try{
        asio::post(
            io_decoder_,
            std::bind(&WebSocketServer::do_decoder, this,
@@ -328,6 +329,11 @@
                      std::ref(*thread_lock_p), std::move(true),
                      msg_data->msg["wav_name"],
                      std::ref(msg_data->tpass_online_handle)));
        }
        catch (std::exception const &e)
        {
            LOG(ERROR)<<e.what();
        }
      }
      break;
    }
@@ -351,6 +357,8 @@
          // keep remain in sample_data
          sample_data_p->erase(sample_data_p->begin(),
                               sample_data_p->begin() + chunksize * setpsize);
          try{
          // post to decode
          asio::post(io_decoder_,
                     std::bind(&WebSocketServer::do_decoder, this,
@@ -361,6 +369,11 @@
                               msg_data->msg["wav_name"],
                               std::ref(msg_data->tpass_online_handle)));
        }
          catch (std::exception const &e)
          {
              LOG(ERROR)<<e.what();
          }
        }
      } else {
        sample_data_p->insert(sample_data_p->end(), pcm_data,
                              pcm_data + num_samples);