ufal / whisper_streaming

Whisper realtime streaming for long speech-to-text transcription and translation
MIT License
2.05k stars 249 forks source link

Why does "whisper_online_server.py" close after I disconnect the client? #106

Closed 1617574886 closed 3 months ago

1617574886 commented 3 months ago

Hello, sir. I am facing a problem that I cannot solve. help me, please. First,I run "whisper_online_server.py" . Then I run ffmpeg -f dshow -i audio="麦克风 (Realtek High Definition Audio)" -f s16le -ac 1 -ar 16000 - | nc.exe localhost 43007 in cmd。 Then I close cmd and "whisper_online_server.py" also stops running. why is this?

1617574886 commented 3 months ago

I understand that it is because there is no anomaly detection when data is received and sent. Therefore, when the client is closed, the server still receives or sends data to the client, causing the program to stop working.

nervjack2 commented 3 months ago

Could I ask how do you solve this problem? Thanks!

1617574886 commented 3 months ago

Could I ask how do you solve this problem? Thanks! 主要就是因为代码里面有几种特殊情况没有进行异常捕获。比如我关闭了客户端的连接以后,服务器还在从客户端读取或则向客户端发消息。然后因为客户端已经关闭了,所以程序就崩溃了。在对应的报错位置加上一些异常捕获就好了。比如online_server这个位置好像就是需要修改的 image