雾聪
2023-08-24 0b692f69b5c8b6a43765cc6e98d3a259a1fc86f9
add message if buffer is null
1个文件已修改
16 ■■■■■ 已修改文件
funasr/runtime/websocket/websocket-server.cpp 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/websocket/websocket-server.cpp
@@ -99,6 +99,22 @@
      }
      LOG(INFO) << "buffer.size=" << buffer.size() << ",result json=" << jsonresult.dump();
    }else{
      websocketpp::lib::error_code ec;
      nlohmann::json jsonresult;        // result json
      jsonresult["text"] = "";  // put result in 'text'
      jsonresult["mode"] = "offline";
        jsonresult["is_final"] = false;
      jsonresult["wav_name"] = wav_name;
      // send the json to client
      if (is_ssl) {
        wss_server_->send(hdl, jsonresult.dump(),
                          websocketpp::frame::opcode::text, ec);
      } else {
        server_->send(hdl, jsonresult.dump(), websocketpp::frame::opcode::text,
                      ec);
      }
    }
  } catch (std::exception const& e) {