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:
|
Args:
|
||||||
frame: The output audio frame to write.
|
frame: The output audio frame to write.
|
||||||
"""
|
"""
|
||||||
if self._client.is_closing:
|
if self._client.is_closing or not self._client.is_connected:
|
||||||
return
|
|
||||||
|
|
||||||
if not self._client.is_connected:
|
|
||||||
# Simulate audio playback with a sleep.
|
|
||||||
await self._write_audio_sleep()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
frame = OutputAudioRawFrame(
|
frame = OutputAudioRawFrame(
|
||||||
|
|||||||
@@ -353,8 +353,6 @@ class WebsocketServerOutputTransport(BaseOutputTransport):
|
|||||||
frame: The output audio frame to write.
|
frame: The output audio frame to write.
|
||||||
"""
|
"""
|
||||||
if not self._websocket:
|
if not self._websocket:
|
||||||
# Simulate audio playback with a sleep.
|
|
||||||
await self._write_audio_sleep()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
frame = OutputAudioRawFrame(
|
frame = OutputAudioRawFrame(
|
||||||
|
|||||||
Reference in New Issue
Block a user