Removing audio sleep from FastAPI and WebSocket server when they are not connected.
This commit is contained in:
@@ -419,12 +419,7 @@ class FastAPIWebsocketOutputTransport(BaseOutputTransport):
|
||||
Args:
|
||||
frame: The output audio frame to write.
|
||||
"""
|
||||
if self._client.is_closing:
|
||||
return
|
||||
|
||||
if not self._client.is_connected:
|
||||
# Simulate audio playback with a sleep.
|
||||
await self._write_audio_sleep()
|
||||
if self._client.is_closing or not self._client.is_connected:
|
||||
return
|
||||
|
||||
frame = OutputAudioRawFrame(
|
||||
|
||||
@@ -353,8 +353,6 @@ class WebsocketServerOutputTransport(BaseOutputTransport):
|
||||
frame: The output audio frame to write.
|
||||
"""
|
||||
if not self._websocket:
|
||||
# Simulate audio playback with a sleep.
|
||||
await self._write_audio_sleep()
|
||||
return
|
||||
|
||||
frame = OutputAudioRawFrame(
|
||||
|
||||
Reference in New Issue
Block a user