Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions livekit-agents/livekit/agents/tts/stream_pacer.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def end_input(self) -> None:
if self._audio_emitter._dst_ch.closed:
# close the stream if the audio emitter is closed
self._closing = True
self._wakeup_event.set()
self._wakeup_event.set() # always wake up to send remaining sentences

async def aclose(self) -> None:
await self._sent_stream.aclose()
Expand Down Expand Up @@ -131,8 +131,10 @@ async def _send_task(self) -> None:
remaining_audio = (
audio_start_time + audio_duration - curr_time if audio_start_time > 0.0 else 0.0
)
if first_sentence or (
generation_stopped and remaining_audio <= self._options.min_remaining_audio
if (
first_sentence
or (generation_stopped and remaining_audio <= self._options.min_remaining_audio)
or (self._input_ended and self._sentences)
):
batch: list[str] = []
while self._sentences:
Expand Down