fix(audio): 修复音频播放死循环并增强错误日志
All checks were successful
ci/woodpecker/tag/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/tag/woodpecker Pipeline was successful
- 修复 PlayWav 和 PlayMP3 在 context 取消时的死循环 bug - 添加 WAV/MP3 解码失败的错误日志 - 添加 TTS 播放开始/完成的日志,便于排查问题 修复前 context 取消会导致无限循环,阻塞后续任务执行。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,9 +45,11 @@ func (tts *AliTTS) Sound(text string) {
|
||||
if text == "" {
|
||||
return
|
||||
}
|
||||
zap.S().Infof("开始播放TTS: %s", text)
|
||||
buf, err := tts.Get(text)
|
||||
if err == nil && buf != nil {
|
||||
audio.PlayWav(tts.ctx, buf)
|
||||
zap.S().Infof("TTS播放完成: %s", text)
|
||||
} else {
|
||||
zap.S().Errorln("AliTTS 请求异常: ", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user