This commit is contained in:
HuangHai
2026-01-31 17:29:57 +08:00
parent fe4d593771
commit 00375a80b2
6 changed files with 94 additions and 32 deletions

View File

@@ -98,6 +98,13 @@ class MyCallback(QwenTtsRealtimeCallback):
print('[TTS] 会话结束')
self.all_data_received = True
self.complete_event.set()
# [Fix] 如果直到会话结束都还没达到缓冲阈值(短文本情况),强制启动播放
if not self.is_playing:
print("[TTS] 会话已结束但未达缓冲阈值,强制启动播放...")
self.is_playing = True
self.playback_thread = threading.Thread(target=self._playback_worker)
self.playback_thread.start()
except Exception as e:
print(f'[Error] 处理回调事件异常: {e}')