debug: add TTS send_bytes logging to pipeline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-25 06:19:18 -08:00
parent 5be7f9c078
commit 75083f23aa
1 changed files with 5 additions and 1 deletions

View File

@ -461,15 +461,19 @@ class VoicePipelineTask:
return
# Send audio in WS-sized chunks
sent_bytes = 0
offset = 0
while offset < len(audio_bytes) and not self._cancelled_tts:
end = min(offset + _WS_AUDIO_CHUNK, len(audio_bytes))
try:
await self.websocket.send_bytes(audio_bytes[offset:end])
except Exception:
sent_bytes += end - offset
except Exception as e:
print(f"[pipeline] [TTS] send_bytes failed at {offset}/{len(audio_bytes)}: {e}", flush=True)
break
offset = end
await asyncio.sleep(0.005)
print(f"[pipeline] [TTS] Sent {sent_bytes}/{len(audio_bytes)} bytes for: \"{text[:20]}\"", flush=True)
except Exception as exc:
logger.error("TTS chunk error: %s", exc)